aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.DS_Storebin0 -> 6148 bytes
-rw-r--r--package-lock.json119
-rw-r--r--src/.DS_Storebin0 -> 6148 bytes
-rw-r--r--src/client/documents/Documents.ts42
-rw-r--r--src/client/views/Main.tsx6
-rw-r--r--src/client/views/nodes/DocumentView.tsx3
-rw-r--r--src/client/views/nodes/FieldView.tsx9
-rw-r--r--src/client/views/nodes/WebBox.scss13
-rw-r--r--src/client/views/nodes/WebBox.tsx73
-rw-r--r--src/fields/BasicField 2.ts38
-rw-r--r--src/fields/WebField.ts21
11 files changed, 321 insertions, 3 deletions
diff --git a/.DS_Store b/.DS_Store
new file mode 100644
index 000000000..8493b4a74
--- /dev/null
+++ b/.DS_Store
Binary files differ
diff --git a/package-lock.json b/package-lock.json
index d74c77819..4f3176751 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -10,6 +10,8 @@
"integrity": "sha512-7jGW8ppV0ant637pIqAcFfQDDH1orEPGJb8aXfUozuCU3QqX7rX4DA8iwrbPrR1hcH0FTTHz47yQnk+bl5xHQA==",
"requires": {
"regenerator-runtime": "^0.12.0"
+<<<<<<< HEAD
+=======
},
"dependencies": {
"regenerator-runtime": {
@@ -17,6 +19,7 @@
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.12.1.tgz",
"integrity": "sha512-odxIc1/vDlo4iZcfXqRYFj0vpXFNoGdKMAUieAlFYO6m/nl5e9KR/beGf41z4a1FI+aQgtjhuaSlDxQ0hmkrHg=="
}
+>>>>>>> bb418216efa9cc2e191b970e4cbe5080f4fd2b87
}
},
"@fortawesome/fontawesome-common-types": {
@@ -67,6 +70,8 @@
"requires": {
"@types/connect": "*",
"@types/node": "*"
+<<<<<<< HEAD
+=======
}
},
"@types/bson": {
@@ -75,6 +80,7 @@
"integrity": "sha512-j+UcCWI+FsbI5/FQP/Kj2CXyplWAz39ktHFkXk84h7dNblKRSoNJs95PZFRd96NQGqsPEPgeclqnznWZr14ZDA==",
"requires": {
"@types/node": "*"
+>>>>>>> bb418216efa9cc2e191b970e4cbe5080f4fd2b87
}
},
"@types/caseless": {
@@ -94,6 +100,8 @@
"integrity": "sha512-4r8qa0quOvh7lGD0pre62CAb1oni1OO6ecJLGCezTmhQ8Fz50Arx9RUszryR8KlgK6avuSXvviL6yWyViQABOg==",
"requires": {
"@types/node": "*"
+<<<<<<< HEAD
+=======
}
},
"@types/connect-flash": {
@@ -102,6 +110,7 @@
"integrity": "sha512-QC93TwnTZ0sk//bfT81o7U4GOedbOZAcgvqi0v1vJqCESC8tqIVnhzB1CHiAUBUWFjoxG5JQF0TYaNa6DMb6Ig==",
"requires": {
"@types/express": "*"
+>>>>>>> bb418216efa9cc2e191b970e4cbe5080f4fd2b87
}
},
"@types/express": {
@@ -112,6 +121,8 @@
"@types/body-parser": "*",
"@types/express-serve-static-core": "*",
"@types/serve-static": "*"
+<<<<<<< HEAD
+=======
}
},
"@types/express-flash": {
@@ -121,6 +132,7 @@
"requires": {
"@types/connect-flash": "*",
"@types/express": "*"
+>>>>>>> bb418216efa9cc2e191b970e4cbe5080f4fd2b87
}
},
"@types/express-serve-static-core": {
@@ -130,6 +142,8 @@
"requires": {
"@types/node": "*",
"@types/range-parser": "*"
+<<<<<<< HEAD
+=======
}
},
"@types/express-session": {
@@ -155,6 +169,7 @@
"integrity": "sha512-JAMFhOaHIciYVh8fb5/83nmuO/AHwmto+Hq7a9y8FzLDcC1KCU344XDOMEmahnrTFlHjgh4L0WJFczNIX2GxnQ==",
"requires": {
"@types/node": "*"
+>>>>>>> bb418216efa9cc2e191b970e4cbe5080f4fd2b87
}
},
"@types/jquery": {
@@ -163,6 +178,8 @@
"integrity": "sha512-FhJvBninYD36v3k6c+bVk1DSZwh7B5Dpb/Pyk3HKVsiohn0nhbefZZ+3JXbWQhFyt0MxSl2jRDdGQPHeOHFXrQ==",
"requires": {
"@types/sizzle": "*"
+<<<<<<< HEAD
+=======
}
},
"@types/jsonwebtoken": {
@@ -171,6 +188,7 @@
"integrity": "sha512-YKnUTR4VxwljbPORPrRon9E3uel1aD8nUdvzqArCCdMTWPvo0gnI2UZkwIHN2QATdj6HYXV/Iq3/KcecAO42Ww==",
"requires": {
"@types/node": "*"
+>>>>>>> bb418216efa9cc2e191b970e4cbe5080f4fd2b87
}
},
"@types/lodash": {
@@ -378,6 +396,8 @@
"integrity": "sha512-XiYCcn/CBajrj18vLA3kO79AHr5yZTCJe2kl87ZNTRxLO14y9D0IGeGZ3xLsqhfYrJSkkVzAJV8v+bQ4nuKCRQ==",
"requires": {
"@types/react": "*"
+<<<<<<< HEAD
+=======
}
},
"@types/request": {
@@ -389,6 +409,7 @@
"@types/form-data": "*",
"@types/node": "*",
"@types/tough-cookie": "*"
+>>>>>>> bb418216efa9cc2e191b970e4cbe5080f4fd2b87
}
},
"@types/serve-static": {
@@ -1204,6 +1225,8 @@
"integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=",
"requires": {
"tweetnacl": "^0.14.3"
+<<<<<<< HEAD
+=======
}
},
"better-assert": {
@@ -1212,6 +1235,7 @@
"integrity": "sha1-QIZrnhueC1W0gYlDEeaPr/rrxSI=",
"requires": {
"callsite": "1.0.0"
+>>>>>>> bb418216efa9cc2e191b970e4cbe5080f4fd2b87
}
},
"big.js": {
@@ -1639,6 +1663,8 @@
"has-ansi": "^2.0.0",
"strip-ansi": "^3.0.0",
"supports-color": "^2.0.0"
+<<<<<<< HEAD
+=======
}
},
"character-parser": {
@@ -1647,6 +1673,7 @@
"integrity": "sha1-x84o821LzZdE5f/CxfzeHHMmH8A=",
"requires": {
"is-regex": "^1.0.3"
+>>>>>>> bb418216efa9cc2e191b970e4cbe5080f4fd2b87
}
},
"check-error": {
@@ -2587,6 +2614,8 @@
"requires": {
"jsbn": "~0.1.0",
"safer-buffer": "^2.1.0"
+<<<<<<< HEAD
+=======
}
},
"ecdsa-sig-formatter": {
@@ -2595,6 +2624,7 @@
"integrity": "sha1-HFlQAPBKiJffuFAAiSoPTDOvhsM=",
"requires": {
"safe-buffer": "^5.0.1"
+>>>>>>> bb418216efa9cc2e191b970e4cbe5080f4fd2b87
}
},
"ee-first": {
@@ -2639,6 +2669,8 @@
"dev": true,
"requires": {
"once": "^1.4.0"
+<<<<<<< HEAD
+=======
}
},
"engine.io": {
@@ -2702,6 +2734,7 @@
"base64-arraybuffer": "0.1.5",
"blob": "0.0.5",
"has-binary2": "~1.0.2"
+>>>>>>> bb418216efa9cc2e191b970e4cbe5080f4fd2b87
}
},
"enhanced-resolve": {
@@ -2991,6 +3024,8 @@
"resolved": "https://registry.npmjs.org/express-session/-/express-session-1.15.6.tgz",
"integrity": "sha512-r0nrHTCYtAMrFwZ0kBzZEXa1vtPVrw0dKvGSrKP4dahwBQ1BJpF2/y1Pp4sCD/0kvxV4zZeclyvfmw0B4RMJQA==",
"requires": {
+<<<<<<< HEAD
+=======
"cookie": "0.3.1",
"cookie-signature": "1.0.6",
"crc": "3.4.4",
@@ -3026,6 +3061,7 @@
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz",
"integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=",
"requires": {
+>>>>>>> bb418216efa9cc2e191b970e4cbe5080f4fd2b87
"assign-symbols": "^1.0.0",
"is-extendable": "^1.0.1"
},
@@ -3139,6 +3175,8 @@
"promise": "^7.0.3",
"ua-parser-js": "^0.7.9",
"whatwg-fetch": "^0.9.0"
+<<<<<<< HEAD
+=======
},
"dependencies": {
"core-js": {
@@ -3146,6 +3184,7 @@
"resolved": "https://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz",
"integrity": "sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY="
}
+>>>>>>> bb418216efa9cc2e191b970e4cbe5080f4fd2b87
}
},
"figgy-pudding": {
@@ -4074,6 +4113,8 @@
"requires": {
"ajv": "^6.5.5",
"har-schema": "^2.0.0"
+<<<<<<< HEAD
+=======
}
},
"has": {
@@ -4082,6 +4123,7 @@
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
"requires": {
"function-bind": "^1.1.1"
+>>>>>>> bb418216efa9cc2e191b970e4cbe5080f4fd2b87
}
},
"has-ansi": {
@@ -4090,6 +4132,8 @@
"integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=",
"requires": {
"ansi-regex": "^2.0.0"
+<<<<<<< HEAD
+=======
}
},
"has-binary2": {
@@ -4105,6 +4149,7 @@
"resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz",
"integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4="
}
+>>>>>>> bb418216efa9cc2e191b970e4cbe5080f4fd2b87
}
},
"has-cors": {
@@ -4853,6 +4898,8 @@
"integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==",
"requires": {
"minimist": "^1.2.0"
+<<<<<<< HEAD
+=======
}
},
"jsonwebtoken": {
@@ -4876,6 +4923,7 @@
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
"integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg=="
}
+>>>>>>> bb418216efa9cc2e191b970e4cbe5080f4fd2b87
}
},
"jsprim": {
@@ -5540,6 +5588,8 @@
"dev": true,
"requires": {
"has-flag": "^3.0.0"
+<<<<<<< HEAD
+=======
}
}
}
@@ -5589,6 +5639,7 @@
"integrity": "sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==",
"requires": {
"lodash": "^4.17.10"
+>>>>>>> bb418216efa9cc2e191b970e4cbe5080f4fd2b87
}
},
"ms": {
@@ -5615,6 +5666,8 @@
"mkdirp": "^0.5.1",
"rimraf": "^2.5.4",
"run-queue": "^1.0.3"
+<<<<<<< HEAD
+=======
}
},
"mpath": {
@@ -5647,6 +5700,7 @@
"ms": "2.0.0"
}
}
+>>>>>>> bb418216efa9cc2e191b970e4cbe5080f4fd2b87
}
},
"ms": {
@@ -6553,8 +6607,12 @@
},
"copy-concurrently": {
"version": "1.0.5",
+<<<<<<< HEAD
+ "bundled": true,
+=======
"resolved": "https://registry.npmjs.org/copy-concurrently/-/copy-concurrently-1.0.5.tgz",
"integrity": "sha512-f2domd9fsVDFtaFcbaRZuYXwtdmnzqbADSwhSWYxYB/Q8zsdUUFMXVRwXGDMWmbEzAn1kdRrtI1T/KTFOL4X2A==",
+>>>>>>> bb418216efa9cc2e191b970e4cbe5080f4fd2b87
"requires": {
"aproba": "^1.1.1",
"fs-write-stream-atomic": "^1.0.8",
@@ -7020,8 +7078,12 @@
},
"gauge": {
"version": "2.7.4",
+<<<<<<< HEAD
+ "bundled": true,
+=======
"resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz",
"integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=",
+>>>>>>> bb418216efa9cc2e191b970e4cbe5080f4fd2b87
"requires": {
"aproba": "^1.0.3",
"console-control-strings": "^1.0.0",
@@ -7057,8 +7119,12 @@
},
"gentle-fs": {
"version": "2.0.1",
+<<<<<<< HEAD
+ "bundled": true,
+=======
"resolved": "https://registry.npmjs.org/gentle-fs/-/gentle-fs-2.0.1.tgz",
"integrity": "sha512-cEng5+3fuARewXktTEGbwsktcldA+YsnUEaXZwcK/3pjSE1X9ObnTs+/8rYf8s+RnIcQm2D5x3rwpN7Zom8Bew==",
+>>>>>>> bb418216efa9cc2e191b970e4cbe5080f4fd2b87
"requires": {
"aproba": "^1.1.2",
"fs-vacuum": "^1.2.10",
@@ -7126,8 +7192,12 @@
},
"got": {
"version": "6.7.1",
+<<<<<<< HEAD
+ "bundled": true,
+=======
"resolved": "https://registry.npmjs.org/got/-/got-6.7.1.tgz",
"integrity": "sha1-JAzQV4WpoY5WHcG0S0HHY+8ejbA=",
+>>>>>>> bb418216efa9cc2e191b970e4cbe5080f4fd2b87
"requires": {
"create-error-class": "^3.0.0",
"duplexer3": "^0.1.4",
@@ -7470,8 +7540,12 @@
},
"libcipm": {
"version": "3.0.3",
+<<<<<<< HEAD
+ "bundled": true,
+=======
"resolved": "https://registry.npmjs.org/libcipm/-/libcipm-3.0.3.tgz",
"integrity": "sha512-71V5CpTI+zFydTc5IjJ/tx8JHbXEJvmYF2zaSVW1V3X1rRnRjXqh44iuiyry1xgi3ProUQ1vX1uwFiWs00+2og==",
+>>>>>>> bb418216efa9cc2e191b970e4cbe5080f4fd2b87
"requires": {
"bin-links": "^1.1.2",
"bluebird": "^3.5.1",
@@ -7492,8 +7566,12 @@
},
"libnpm": {
"version": "2.0.1",
+<<<<<<< HEAD
+ "bundled": true,
+=======
"resolved": "https://registry.npmjs.org/libnpm/-/libnpm-2.0.1.tgz",
"integrity": "sha512-qTKoxyJvpBxHZQB6k0AhSLajyXq9ZE/lUsZzuHAplr2Bpv9G+k4YuYlExYdUCeVRRGqcJt8hvkPh4tBwKoV98w==",
+>>>>>>> bb418216efa9cc2e191b970e4cbe5080f4fd2b87
"requires": {
"bin-links": "^1.1.2",
"bluebird": "^3.5.3",
@@ -7795,8 +7873,12 @@
},
"make-fetch-happen": {
"version": "4.0.1",
+<<<<<<< HEAD
+ "bundled": true,
+=======
"resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-4.0.1.tgz",
"integrity": "sha512-7R5ivfy9ilRJ1EMKIOziwrns9fGeAD4bAha8EB7BIiBBLHm2KeTUGCrICFt2rbHfzheTLynv50GnNTK1zDTrcQ==",
+>>>>>>> bb418216efa9cc2e191b970e4cbe5080f4fd2b87
"requires": {
"agentkeepalive": "^3.4.1",
"cacache": "^11.0.1",
@@ -7906,8 +7988,12 @@
},
"move-concurrently": {
"version": "1.0.1",
+<<<<<<< HEAD
+ "bundled": true,
+=======
"resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz",
"integrity": "sha1-viwAX9oy4LKa8fBdfEszIUxwH5I=",
+>>>>>>> bb418216efa9cc2e191b970e4cbe5080f4fd2b87
"requires": {
"aproba": "^1.1.1",
"copy-concurrently": "^1.0.0",
@@ -7946,8 +8032,12 @@
},
"node-gyp": {
"version": "3.8.0",
+<<<<<<< HEAD
+ "bundled": true,
+=======
"resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-3.8.0.tgz",
"integrity": "sha512-3g8lYefrRRzvGeSowdJKAKyks8oUpLEd/DyPV4eMhVlhJ0aNaZqIrNUIPuEWWTAoPqyFkfGrM67MC69baqn6vA==",
+>>>>>>> bb418216efa9cc2e191b970e4cbe5080f4fd2b87
"requires": {
"fstream": "^1.0.0",
"glob": "^7.0.3",
@@ -8037,8 +8127,12 @@
},
"npm-lifecycle": {
"version": "2.1.0",
+<<<<<<< HEAD
+ "bundled": true,
+=======
"resolved": "https://registry.npmjs.org/npm-lifecycle/-/npm-lifecycle-2.1.0.tgz",
"integrity": "sha512-QbBfLlGBKsktwBZLj6AviHC6Q9Y3R/AY4a2PYSIRhSKSS0/CxRyD/PfxEX6tPeOCXQgMSNdwGeECacstgptc+g==",
+>>>>>>> bb418216efa9cc2e191b970e4cbe5080f4fd2b87
"requires": {
"byline": "^5.0.0",
"graceful-fs": "^4.1.11",
@@ -8228,8 +8322,12 @@
},
"pacote": {
"version": "9.4.0",
+<<<<<<< HEAD
+ "bundled": true,
+=======
"resolved": "https://registry.npmjs.org/pacote/-/pacote-9.4.0.tgz",
"integrity": "sha512-WQ1KL/phGMkedYEQx9ODsjj7xvwLSpdFJJdEXrLyw5SILMxcTNt5DTxT2Z93fXuLFYJBlZJdnwdalrQdB/rX5w==",
+>>>>>>> bb418216efa9cc2e191b970e4cbe5080f4fd2b87
"requires": {
"bluebird": "^3.5.3",
"cacache": "^11.3.2",
@@ -8586,8 +8684,12 @@
},
"request": {
"version": "2.88.0",
+<<<<<<< HEAD
+ "bundled": true,
+=======
"resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz",
"integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==",
+>>>>>>> bb418216efa9cc2e191b970e4cbe5080f4fd2b87
"requires": {
"aws-sign2": "~0.7.0",
"aws4": "^1.8.0",
@@ -8986,8 +9088,12 @@
},
"tar": {
"version": "4.4.8",
+<<<<<<< HEAD
+ "bundled": true,
+=======
"resolved": "https://registry.npmjs.org/tar/-/tar-4.4.8.tgz",
"integrity": "sha512-LzHF64s5chPQQS0IYBn9IN5h3i98c12bo4NCO7e0sGM2llXQ3p2FGC5sdENN4cTW48O915Sh+x+EXx7XW96xYQ==",
+>>>>>>> bb418216efa9cc2e191b970e4cbe5080f4fd2b87
"requires": {
"chownr": "^1.1.1",
"fs-minipass": "^1.2.5",
@@ -9334,8 +9440,12 @@
},
"yargs": {
"version": "11.0.0",
+<<<<<<< HEAD
+ "bundled": true,
+=======
"resolved": "https://registry.npmjs.org/yargs/-/yargs-11.0.0.tgz",
"integrity": "sha512-Rjp+lMYQOWtgqojx1dEWorjCofi1YN7AoFvYV7b1gx/7dAAeuI4kN5SZiEvr0ZmsZTOpDRcCqrpI10L31tFkBw==",
+>>>>>>> bb418216efa9cc2e191b970e4cbe5080f4fd2b87
"requires": {
"cliui": "^4.0.0",
"decamelize": "^1.1.1",
@@ -10103,6 +10213,8 @@
"parse-asn1": "^5.0.0",
"randombytes": "^2.0.1",
"safe-buffer": "^5.1.2"
+<<<<<<< HEAD
+=======
}
},
"pug": {
@@ -10212,6 +10324,7 @@
"integrity": "sha1-8VWVkiBu3G+FMQ2s9K+0igJa9Z8=",
"requires": {
"pug-error": "^1.3.2"
+>>>>>>> bb418216efa9cc2e191b970e4cbe5080f4fd2b87
}
},
"pug-walk": {
@@ -11138,6 +11251,8 @@
"integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
"requires": {
"is-buffer": "^1.1.5"
+<<<<<<< HEAD
+=======
}
}
}
@@ -11222,6 +11337,7 @@
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"requires": {
"ms": "2.0.0"
+>>>>>>> bb418216efa9cc2e191b970e4cbe5080f4fd2b87
}
},
"isarray": {
@@ -13247,6 +13363,8 @@
"graceful-fs": "^4.1.11",
"imurmurhash": "^0.1.4",
"signal-exit": "^3.0.2"
+<<<<<<< HEAD
+=======
}
},
"ws": {
@@ -13255,6 +13373,7 @@
"integrity": "sha512-tbSxiT+qJI223AP4iLfQbkbxkwdFcneYinM2+x46Gx2wgvbaOMO36czfdfVUBRTHvzAMRhDd98sA5d/BuWbQdg==",
"requires": {
"async-limiter": "~1.0.0"
+>>>>>>> bb418216efa9cc2e191b970e4cbe5080f4fd2b87
}
},
"xdg-basedir": {
diff --git a/src/.DS_Store b/src/.DS_Store
new file mode 100644
index 000000000..4d6acb95a
--- /dev/null
+++ b/src/.DS_Store
Binary files differ
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts
index 15ecfbfe6..398c6f1a2 100644
--- a/src/client/documents/Documents.ts
+++ b/src/client/documents/Documents.ts
@@ -7,10 +7,17 @@ import { ListField } from "../../fields/ListField";
import { FormattedTextBox } from "../views/nodes/FormattedTextBox";
import { ImageField } from "../../fields/ImageField";
import { ImageBox } from "../views/nodes/ImageBox";
+<<<<<<< HEAD
+import { WebField } from "../../fields/WebField";
+import { WebBox } from "../views/nodes/WebBox";
+import { CollectionFreeFormView } from "../views/collections/CollectionFreeFormView";
+import { FieldId } from "../../fields/Field";
+=======
import { CollectionView, CollectionViewType } from "../views/collections/CollectionView";
import { FieldView } from "../views/nodes/FieldView";
import { HtmlField } from "../../fields/HtmlField";
import { WebView } from "../views/nodes/WebView";
+>>>>>>> bb418216efa9cc2e191b970e4cbe5080f4fd2b87
export interface DocumentOptions {
x?: number;
@@ -77,7 +84,7 @@ export namespace Documents {
export function TextDocument(options: DocumentOptions = {}): Document {
let doc = GetTextPrototype().MakeDelegate();
setupOptions(doc, options);
- // doc.SetField(KeyStore.Data, new RichTextField());
+ // doc.Set(KeyStore.Data, new RichTextField());
return doc;
}
@@ -116,7 +123,7 @@ export namespace Documents {
imageProto.Set(KeyStore.Layout, new TextField(CollectionView.LayoutString("AnnotationsKey")));
imageProto.SetNumber(KeyStore.ViewType, CollectionViewType.Freeform)
imageProto.Set(KeyStore.BackgroundLayout, new TextField(ImageBox.LayoutString()));
- // imageProto.SetField(KeyStore.Layout, new TextField('<div style={"background-image: " + {Data}} />'));
+ // imageProto.Set(KeyStore.Layout, new TextField('<div style={"background-image: " + {Data}} />'));
imageProto.Set(KeyStore.LayoutKeys, new ListField([KeyStore.Data, KeyStore.Annotations]));
return imageProto;
}
@@ -153,6 +160,37 @@ export namespace Documents {
return doc;
}
+ let webProtoId: FieldId;
+ function GetWebPrototype(): Document {
+ if (webProtoId === undefined) {
+ let webProto = new Document();
+ webProtoId = webProto.Id;
+ webProto.Set(KeyStore.Title, new TextField("WEB PROTO"));
+ webProto.Set(KeyStore.X, new NumberField(0));
+ webProto.Set(KeyStore.Y, new NumberField(0));
+ webProto.Set(KeyStore.NativeWidth, new NumberField(300));
+ webProto.Set(KeyStore.NativeHeight, new NumberField(300));
+ webProto.Set(KeyStore.Width, new NumberField(300));
+ webProto.Set(KeyStore.Height, new NumberField(300));
+ webProto.Set(KeyStore.Layout, new TextField(CollectionFreeFormView.LayoutString("AnnotationsKey")));
+ webProto.Set(KeyStore.BackgroundLayout, new TextField(WebBox.LayoutString()));
+ webProto.Set(KeyStore.LayoutKeys, new ListField([KeyStore.Data, KeyStore.Annotations]));
+ Server.AddDocument(webProto);
+ return webProto;
+ }
+ return Server.GetField(webProtoId) as Document;
+ }
+
+ export function WebDocument(url: string, options: DocumentOptions = {}): Document {
+ let doc = GetWebPrototype().MakeDelegate();
+ setupOptions(doc, options);
+ doc.Set(KeyStore.Data, new WebField(new URL(url)));
+ Server.AddDocument(doc);
+ var sdoc = Server.GetField(doc.Id) as Document;
+ console.log(sdoc);
+ return sdoc;
+ }
+
let collectionProto: Document;
const collectionProtoId = "collectionProto";
function GetCollectionPrototype(): Document {
diff --git a/src/client/views/Main.tsx b/src/client/views/Main.tsx
index 61ad66c72..69ded8fa7 100644
--- a/src/client/views/Main.tsx
+++ b/src/client/views/Main.tsx
@@ -85,6 +85,9 @@ Documents.initProtos(() => {
let addImageNode = action(() => Documents.ImageDocument("https://upload.wikimedia.org/wikipedia/commons/thumb/3/3a/Cat03.jpg/1200px-Cat03.jpg", {
width: 200, height: 200, title: "an image of a cat"
}));
+ let addWebNode = action(() => Documents.WebDocument("https://cs.brown.edu/courses/cs166/", {
+ width: 200, height: 200, title: "an image of a cat"
+ }));
let addClick = (creator: any) => action(() => {
var img = creator();
@@ -94,6 +97,7 @@ Documents.initProtos(() => {
});
let imgRef = React.createRef<HTMLDivElement>();
+ let webRef = React.createRef<HTMLDivElement>();
let textRef = React.createRef<HTMLDivElement>();
let schemaRef = React.createRef<HTMLDivElement>();
let colRef = React.createRef<HTMLDivElement>();
@@ -132,6 +136,8 @@ Documents.initProtos(() => {
<ContextMenu />
<div style={{ position: 'absolute', bottom: '0px', left: '0px', width: '150px' }} ref={imgRef} >
<button onPointerDown={onRowDown(addImageNode, imgRef)} onClick={addClick(addImageNode)}>Add Image</button></div>
+ <div style={{ position: 'absolute', bottom: '0px', left: '0px', width: '150px' }} ref={webRef} >
+ <button onPointerDown={onRowDown(addWebNode, webRef)} onClick={addClick(addWebNode)}>Add Web</button></div>
<div style={{ position: 'absolute', bottom: '25px', left: '0px', width: '150px' }} ref={textRef}>
<button onPointerDown={onRowDown(addTextNode, textRef)} onClick={addClick(addTextNode)}>Add Text</button></div>
<div style={{ position: 'absolute', bottom: '50px', left: '0px', width: '150px' }} ref={colRef}>
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index 6fe78daee..f4ebfb4d8 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -16,6 +16,7 @@ import { WebView } from "./WebView";
import { ContextMenu } from "../ContextMenu";
import { FormattedTextBox } from "../nodes/FormattedTextBox";
import { ImageBox } from "../nodes/ImageBox";
+import { WebBox } from "../nodes/WebBox";
import "./DocumentView.scss";
import React = require("react");
const JsxParser = require('react-jsx-parser').default;//TODO Why does this need to be imported like this?
@@ -198,7 +199,7 @@ export class DocumentView extends React.Component<DocumentViewProps> {
@computed get mainContent() {
var val = this.props.Document.Id;
return <JsxParser
- components={{ FormattedTextBox, ImageBox, CollectionFreeFormView, CollectionDockingView, CollectionSchemaView, CollectionView, WebView }}
+ components={{ FormattedTextBox, ImageBox, WebBox, CollectionFreeFormView, CollectionDockingView, CollectionSchemaView, CollectionView, WebView }}
bindings={this._documentBindings}
jsx={this.layout}
showWarnings={true}
diff --git a/src/client/views/nodes/FieldView.tsx b/src/client/views/nodes/FieldView.tsx
index 1a9d325db..368ad049d 100644
--- a/src/client/views/nodes/FieldView.tsx
+++ b/src/client/views/nodes/FieldView.tsx
@@ -7,11 +7,17 @@ import { TextField } from "../../../fields/TextField";
import { NumberField } from "../../../fields/NumberField";
import { RichTextField } from "../../../fields/RichTextField";
import { ImageField } from "../../../fields/ImageField";
+import { WebField } from "../../../fields/WebField";
import { Key } from "../../../fields/Key";
import { FormattedTextBox } from "./FormattedTextBox";
import { ImageBox } from "./ImageBox";
+<<<<<<< HEAD
+import { WebBox } from "./WebBox";
+import { DocumentView } from "./DocumentView";
+=======
import { HtmlField } from "../../../fields/HtmlField";
import { WebView } from "./WebView";
+>>>>>>> bb418216efa9cc2e191b970e4cbe5080f4fd2b87
//
// these properties get assigned through the render() method of the DocumentView when it creates this node.
@@ -50,6 +56,9 @@ export class FieldView extends React.Component<FieldViewProps> {
else if (field instanceof ImageField) {
return <ImageBox {...this.props} />
}
+ else if (field instanceof WebField) {
+ return <WebBox {...this.props} />
+ }
else if (field instanceof NumberField) {
return <p>{field.Data}</p>
} else if (field instanceof HtmlField) {
diff --git a/src/client/views/nodes/WebBox.scss b/src/client/views/nodes/WebBox.scss
new file mode 100644
index 000000000..9df984d68
--- /dev/null
+++ b/src/client/views/nodes/WebBox.scss
@@ -0,0 +1,13 @@
+
+.webBox-cont {
+ padding: 0vw;
+ position: absolute;
+ width: 100%
+}
+
+.webBox-button {
+ padding : 0vw;
+ border: none;
+ width : 100%;
+ height: 100%;
+} \ No newline at end of file
diff --git a/src/client/views/nodes/WebBox.tsx b/src/client/views/nodes/WebBox.tsx
new file mode 100644
index 000000000..b9d0853b9
--- /dev/null
+++ b/src/client/views/nodes/WebBox.tsx
@@ -0,0 +1,73 @@
+
+import Lightbox from 'react-image-lightbox';
+import { SelectionManager } from "../../util/SelectionManager";
+import "./WebBox.scss";
+import React = require("react")
+import { WebField } from '../../../fields/WebField';
+import { FieldViewProps, FieldView } from './FieldView';
+import { CollectionFreeFormDocumentView } from './CollectionFreeFormDocumentView';
+import { FieldWaiting } from '../../../fields/Field';
+import { observer } from "mobx-react"
+import { observable, action, spy } from 'mobx';
+import { KeyStore } from '../../../fields/Key';
+
+@observer
+export class WebBox extends React.Component<FieldViewProps> {
+
+ public static LayoutString() { return FieldView.LayoutString("WebBox"); }
+ private _ref: React.RefObject<HTMLDivElement>;
+ private _downX: number = 0;
+ private _downY: number = 0;
+ private _lastTap: number = 0;
+ @observable private _isOpen: boolean = false;
+
+ constructor(props: FieldViewProps) {
+ super(props);
+
+ this._ref = React.createRef();
+ this.state = {
+ isOpen: false,
+ };
+ }
+
+ componentDidMount() {
+ }
+
+ componentWillUnmount() {
+ }
+
+ onPointerDown = (e: React.PointerEvent): void => {
+ if (Date.now() - this._lastTap < 300) {
+ if (e.buttons === 1 && this.props.DocumentViewForField instanceof CollectionFreeFormDocumentView &&
+ SelectionManager.IsSelected(this.props.DocumentViewForField)) {
+ e.stopPropagation();
+ this._downX = e.clientX;
+ this._downY = e.clientY;
+ document.removeEventListener("pointerup", this.onPointerUp);
+ document.addEventListener("pointerup", this.onPointerUp);
+ }
+ } else {
+ this._lastTap = Date.now();
+ }
+ }
+ @action
+ onPointerUp = (e: PointerEvent): void => {
+ document.removeEventListener("pointerup", this.onPointerUp);
+ if (Math.abs(e.clientX - this._downX) < 2 && Math.abs(e.clientY - this._downY) < 2) {
+ this._isOpen = true;
+ }
+ e.stopPropagation();
+ }
+
+ render() {
+ let field = this.props.doc.Get(this.props.fieldKey);
+ let path = field == FieldWaiting ? "https://image.flaticon.com/icons/svg/66/66163.svg" :
+ field instanceof WebField ? field.Data.href : "https://crossorigin.me/" + "https://cs.brown.edu";
+ let nativeWidth = this.props.doc.GetNumber(KeyStore.NativeWidth, 1);
+
+ return (
+ <div className="webBox-cont" onPointerDown={this.onPointerDown} ref={this._ref} >
+ <iframe src={path} width={nativeWidth}></iframe>
+ </div>)
+ }
+} \ No newline at end of file
diff --git a/src/fields/BasicField 2.ts b/src/fields/BasicField 2.ts
new file mode 100644
index 000000000..437024d07
--- /dev/null
+++ b/src/fields/BasicField 2.ts
@@ -0,0 +1,38 @@
+import { Field } from "./Field"
+import { observable, computed, action } from "mobx";
+
+export abstract class BasicField<T> extends Field {
+ constructor(data: T) {
+ super();
+
+ this.data = data;
+ }
+
+ @observable
+ private data:T;
+
+ @computed
+ get Data(): T {
+ return this.data;
+ }
+
+ set Data(value: T) {
+ if(this.data === value) {
+ return;
+ }
+ this.data = value;
+ }
+
+ @action
+ TrySetValue(value: any): boolean {
+ if (typeof value == typeof this.data) {
+ this.Data = value;
+ return true;
+ }
+ return false;
+ }
+
+ GetValue(): any {
+ return this.Data;
+ }
+}
diff --git a/src/fields/WebField.ts b/src/fields/WebField.ts
new file mode 100644
index 000000000..cd3519128
--- /dev/null
+++ b/src/fields/WebField.ts
@@ -0,0 +1,21 @@
+import { BasicField } from "./BasicField";
+import { Field } from "./Field";
+
+export class WebField extends BasicField<URL> {
+ constructor(data: URL | undefined = undefined) {
+ super(data == undefined ? new URL("https://crossorigin.me/" + "https://cs.brown.edu/") : data);
+ }
+
+ toString(): string {
+ return this.Data.href;
+ }
+
+ ToScriptString(): string {
+ return `new WebField("${this.Data}")`;
+ }
+
+ Copy(): Field {
+ return new WebField(this.Data);
+ }
+
+} \ No newline at end of file