From b2a65b7a30af2ef75b5009897fb2a89d318c9889 Mon Sep 17 00:00:00 2001 From: madgaksha Date: Sat, 11 May 2019 22:13:39 +0200 Subject: [PATCH] update for monaco editor 0.17 --- CHANGELOG.md | 9 +- README.md | 6 +- demo/package-lock.json | 21 ++ demo/src/main/java/TestBean.java | 9 +- demo/src/main/webapp/test.xhtml | 7 + .../primefaces-blutorange/monacoEditor.html | 10 +- pom.xml | 2 +- src/main/js/widget.js | 26 ++- src/npm/descriptor/create.js | 6 +- src/npm/descriptor/util.js | 123 +++++++--- src/npm/package-lock.json | 220 ++++++++++-------- src/npm/package.json | 6 +- src/npm/primefaces-monaco.d.ts | 12 +- 13 files changed, 297 insertions(+), 160 deletions(-) create mode 100644 demo/package-lock.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 27b5852..5e7ed4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,21 +1,22 @@ See also [the changelog of monaco-editor](https://github.com/Microsoft/monaco-editor/blob/master/CHANGELOG.md). -# 0.17.0 (work in progress) +# 0.17.0 -- update to PrimeFaces 7.0 -- update to monaco editor 0.16.2 +- update to PrimeFaces 7.0 (no guarantees it will work with PrimeFaces 6) +- update to monaco editor 0.17.0 - no more uses of `eval`. - due to the above: the property `extender` of the `monacoEditor` component, if given, must now be a valid JavaScript expression evaluating to an extender object. Loading the extender from an URL is not supported anymore. The recommended way is to define a factory function in an external file and call that. - client-side script `widget.js` now gets minified +- add method `whenReady` to client-side widget +- update npm and maven dependencies # 0.16.2 - reuse model (`ITextModel`) if it exists already - # 0.16.1 - update to monaco editor 0.16.1 (solves an issue with IE) diff --git a/README.md b/README.md index 82206d4..3f8f0c1 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ Make sure you're running at least PrimeFaces 7.0. Include this as a dependency: com.github.blutorange primefaces.monaco - 0.16.2 + 0.17.0 @@ -385,8 +385,8 @@ is for this project. # Release * `mvn versions:display-dependency-updates` -* Check for `TODO`s. (currently: `widget.js`) -* Check `src/npm/descriptor/create.js` whether it reflects the current Monaco Editor API correctly. +* Check for `TODO`s. +* Check `src/npm/descriptor/create.js` whether it reflects the current Monaco Editor API. * Update version in `README.md` (installing) * Update version in `src/main/java/com/github/blutorange/primefaces/util/Constants.java` * Update version in `pom.xml` diff --git a/demo/package-lock.json b/demo/package-lock.json new file mode 100644 index 0000000..96be7cd --- /dev/null +++ b/demo/package-lock.json @@ -0,0 +1,21 @@ +{ + "requires": true, + "lockfileVersion": 1, + "dependencies": { + "@types/jquery": { + "version": "3.3.29", + "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.3.29.tgz", + "integrity": "sha512-FhJvBninYD36v3k6c+bVk1DSZwh7B5Dpb/Pyk3HKVsiohn0nhbefZZ+3JXbWQhFyt0MxSl2jRDdGQPHeOHFXrQ==", + "dev": true, + "requires": { + "@types/sizzle": "*" + } + }, + "@types/sizzle": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.2.tgz", + "integrity": "sha512-7EJYyKTL7tFR8+gDbB6Wwz/arpGa0Mywk1TJbNzKzHtzbwVmY4HR9WqS5VV7dsBUKQmPNr192jHr/VpBluj/hg==", + "dev": true + } + } +} diff --git a/demo/src/main/java/TestBean.java b/demo/src/main/java/TestBean.java index 0fd6b46..db716f5 100644 --- a/demo/src/main/java/TestBean.java +++ b/demo/src/main/java/TestBean.java @@ -7,6 +7,9 @@ import java.io.Serializable; import java.util.Arrays; import java.util.Collection; +import java.util.Map; +import java.util.HashMap; +import java.util.stream.Collectors; @ManagedBean(name="testBean") @ViewScoped @@ -21,12 +24,16 @@ public class TestBean implements Serializable { private void init() { uiLanguage = "en"; theEnum = TheEnum.Foo; - code = "/**\n" + " * @param {number} x The first number.\n" + " * @param {number} y The second number.\n" + " * @return {number} The sum of the numbers\n" + " */\n" + "function testbar(x, y) {\n" + "\treturn x + y;\n" + "}\n" + "const z1 = testbar(5, 3);\n" + "const z2 = testbar(5, 3);\n" + "const z3 = testbar(5, 3);"; + code = "/**\n" + " * @param {number} x The first number.\n" + " * @param {number} y The second number.\n" + " * @return {number} The sum of the numbers\n" + " */\n" + "function testbar(x, y) {\n" + "\treturn x + y;\n" + "}\n" + "const z1 = testbar(5, 3);\n" + "const z2 = testbar(5, 3);\n" + "const z3 = testbar(5, 3);\n\n$(\".acc\").accordion(\"refresh\");"; editorOptions = new EditorOptions() .setLanguage(ELanguage.JAVASCRIPT) .setTheme(ETheme.VS) + .setSuggest(new EditorSuggestOptions() + .addFilteredType("keyword", false) + ) .setLineNumbers(ELineNumbers.ON) .setWordWrap(EWordWrap.ON) + .addRuler(60, 100) .setFontSize(20); } diff --git a/demo/src/main/webapp/test.xhtml b/demo/src/main/webapp/test.xhtml index 3198e70..67f3ea6 100644 --- a/demo/src/main/webapp/test.xhtml +++ b/demo/src/main/webapp/test.xhtml @@ -44,5 +44,12 @@ http://primefaces.org/ui/extensions "> This is the east. + diff --git a/docs/vdldoc/primefaces-blutorange/monacoEditor.html b/docs/vdldoc/primefaces-blutorange/monacoEditor.html index 5a8f7e4..24a3d38 100644 --- a/docs/vdldoc/primefaces-blutorange/monacoEditor.html +++ b/docs/vdldoc/primefaces-blutorange/monacoEditor.html @@ -323,15 +323,9 @@

An extender object to further customize the monaco editor via JavaScript. This can be either:

-

The given extender string is first evaluated as a JavaScript expression; and if that fails, interpreted - as a resource file.

- The extender object may one or more several properties: + The extender object may have one or more several properties: