Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Commit

Permalink
update to 0.18.1, cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
blutorange committed Oct 6, 2019
1 parent f09f1fb commit 267d1f6
Show file tree
Hide file tree
Showing 16 changed files with 492 additions and 1,179 deletions.
79 changes: 42 additions & 37 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,81 +1,86 @@
See also [the changelog of monaco-editor](https://github.com/Microsoft/monaco-editor/blob/master/CHANGELOG.md).

# 0.18.0

* Update to monaco editor `0.18.1`
* Update `EditorOptions` with the new available options

# 0.17.2

- Feature #9. Add new method to extender: `createEditorOverrideOptions`. This lets you pass specify custom override services to the
* Feature #9. Add new method to extender: `createEditorOverrideOptions`. This lets you pass specify custom override services to the
editor.
- Fix #10. Load CSS worker when language is set to SCSS or LESS
- Fix a missing localization (CSS specificity tooltip)
- Fix `https://github.com/microsoft/monaco-editor/issues/1353` (scrolling does not work in Firefox). It will be fixed in
* Fix #10. Load CSS worker when language is set to SCSS or LESS
* Fix a missing localization (CSS specificity tooltip)
* Fix https://github.com/microsoft/monaco-editor/issues/1353 (scrolling does not work in Firefox). It will be fixed in
the next release of monaco-editor. Since it seems to be taking some time, this includes the proposed patch
https://github.com/microsoft/vscode/pull/72832
- Demo project: change from cargo to jetty
* Demo project: change from cargo to jetty

# 0.17.1

- Update to monaco editor 0.17.1
- Add transparent `getValue` / `setValue` methods to the widget API, see #7
- Keep scrolling position during AJAX update, see #8
- The widget is now a `PrimeFaces.widget.DeferredWidget`, so that it works better with
* -Update to monaco editor 0.17.1
* -Add transparent `getValue` / `setValue` methods to the widget API, see #7
* -Keep scrolling position during AJAX update, see #8
* -The widget is now a `PrimeFaces.widget.DeferredWidget`, so that it works better with
`p:tabs` etc, see #6

# 0.17.0

- 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,
* -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
* -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
* -reuse model (`ITextModel`) if it exists already

# 0.16.1

- update to monaco editor 0.16.1 (solves an issue with IE)
- add new languages to the Enum of available code languages (see `EditorOptions#setLanguage`)
- add an optional hook to the extender: `createWorker`. This lets you load your own workers instead of using the default ones.
- add 3 new options to the `monacoEditor` tag: `directory`, `basename`, `extension`. This may be useful in case you need to customize the editor on the client side.
- updated and corrected type definitions
- When the editor is instantiated, create an `ITextModel` manually instead of just passing a value and language in the `IEditorConstructionOptions`. If you are using an `MonacoExtender`, the properties `language` and `value` are still available in the `IEditorConstructionOptions` passed `#beforeCreate`, but they will be removed in version 0.17. Use the property `model` instead.
* -update to monaco editor 0.16.1 (solves an issue with IE)
* -add new languages to the Enum of available code languages (see `EditorOptions#setLanguage`)
* -add an optional hook to the extender: `createWorker`. This lets you load your own workers instead of using the default ones.
* -add 3 new options to the `monacoEditor` tag: `directory`, `basename`, `extension`. This may be useful in case you need to customize the editor on the client side.
* -updated and corrected type definitions
* -When the editor is instantiated, create an `ITextModel` manually instead of just passing a value and language in the `IEditorConstructionOptions`. If you are using an `MonacoExtender`, the properties `language` and `value` are still available in the `IEditorConstructionOptions` passed `#beforeCreate`, but they will be removed in version 0.17. Use the property `model` instead.

# 0.16.0
- update to monaco editor `0.16.0`
- update the editor options, added `cursorSmoothCaretAnimation`, `renderFinalNewline`,
* -update to monaco editor `0.16.0`
* -update the editor options, added `cursorSmoothCaretAnimation`, `renderFinalNewline`,
and `fastScrollSensitivity`

# 0.15.2

- expose part of the interal vscode API to allow for deeper customization
- fix a type in the EditorOptions (codeActionsOnSave is a Map<String, Boolean>)
- update some NPM dependencies
* -expose part of the interal vscode API to allow for deeper customization
* -fix a type in the EditorOptions (codeActionsOnSave is a Map<String, Boolean>)
* -update some NPM dependencies

# 0.15.1

- update Monaco Editor to 0.15.6.
- update NPM dependencies
* -update Monaco Editor to 0.15.6.
* -update NPM dependencies

# 0.15.0

- update Monaco Editor to 0.15.1.
- update NPM dependencies (webpack, style-loader, css-loader)
* -update Monaco Editor to 0.15.1.
* -update NPM dependencies (webpack, style-loader, css-loader)

# 0.14.4

- update NPM dependencies (webpack)
- also trigger events on the main element (PrimeFaces.widget.BaseWidget.jq)
* -update NPM dependencies (webpack)
* -also trigger events on the main element (PrimeFaces.widget.BaseWidget.jq)

# 0.14.3

- update NPM dependencies
- fix a build error with Windows (\ instead of /)
- fix issues #1 and #2
* -update NPM dependencies
* -fix a build error with Windows (\ instead of /)
* -fix issues #1 and #2

# 0.14.2

Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Make sure you're running at least PrimeFaces 7.0. Include this as a dependency:
<dependency>
<groupId>com.github.blutorange</groupId>
<artifactId>primefaces.monaco</artifactId>
<version>0.17.2</version>
<version>0.18.0</version>
</dependency>
</dependencies>

Expand Down Expand Up @@ -401,8 +401,9 @@ is for this project.

# Release

* __CHECK AND REMOVE src/npm/patches/monaco-editor+0.17.1.patch__ (https://github.com/microsoft/monaco-editor/issues/1353)
* `mvn versions:display-dependency-updates`
* Check dependencies for updates:
* `mvn versions:display-dependency-updates`
* `cd src/npm ; npm outdated`
* Check for `TODO`s.
* Check `src/npm/descriptor/create.js` whether it reflects the current Monaco Editor API.
* Update version in `README.md` (installing)
Expand Down
2 changes: 1 addition & 1 deletion demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>monacotest</groupId>
<artifactId>monacotest</artifactId>
<version>0.17.2</version>
<version>0.18.0</version>
<packaging>war</packaging>

<repositories>
Expand Down
21 changes: 17 additions & 4 deletions demo/src/main/webapp/template.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -52,32 +52,45 @@
<script>
var toLog = [];
function log() {
var args = Array.prototype.slice.call(arguments, 0);
args.unshift(undefined);
logColor.apply(null, args);
}
function logColor() {
var args = Array.prototype.slice.call(arguments, 0);
var color = args.shift();
var div = document.getElementById("log");
if (!div) {
toLog.push(arguments);
toLog.push(args);
return;
}
else if (toLog.length !== 0) {
for (var i = 0; i !== toLog.length; ++i) {
var message = Array.prototype.join.call(toLog[i], " ");
var pre = document.createElement("pre");
pre.setAttribute("class", "line");
if (color) {
pre.setAttribute("style", "color: " + color + ";");
}
pre.textContent = message;
div.appendChild(pre);
}
toLog = [];
}
var message = Array.prototype.join.call(arguments, " ");
var message = Array.prototype.join.call(args, " ");
var pre = document.createElement("pre");
pre.setAttribute("class", "line");
if (color) {
pre.setAttribute("style", "color: " + color + ";");
}
pre.textContent = message;
div.appendChild(pre);
}

// Log errors
window.addEventListener("error", function(event) {
log("An unhandled error occurred");
log(event.message);
logColor("red", "An unhandled error occurred");
logColor("red", event.message);
});
</script>
<h:outputScript rendered="#{logXhr}">
Expand Down
6 changes: 4 additions & 2 deletions demo/src/main/webapp/test.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@
window.testCase = function() {
log("Monaco editor should load and be visible");
log("It should have the correct dimensions (full width + height).");
log("It should be possible to edit the content.")
log("It should be possible to edit the content.");
log("Autocompletion for the JQuery API should be available:");
log(" Typing '$.aja' should offer a suggestion for '$.ajax'");
log(" Typing '$.ajax(' should bring up the documentation for its parameters");
log("Changing the language and clicking reload should display the UI (context menu etc.) in the chosen language.");
log("Changing the code language and clicking reload should apply the syntax highlighting for the chosen code lanugage.");
log("When choosing 'javascript', autocompletion for the JQuery API should be available.");
};
</script>
</ui:define>
Expand Down
18 changes: 10 additions & 8 deletions demo/src/main/webapp/test4.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@
<p:commandButton actionListener="#{testBean.toggleRendered}"
value="Click me"
update="@form:tabs:contentDummy,@form:tabs:contentMonaco"
onsuccess="log('pressed button')"
process="@this" />
</p:outputPanel>
</p:tab>
<p:tab id="tabMonaco" title="Monaco">
<p:outputPanel id="contentMonaco">
<blut:monacoEditor widgetVar="monaco" id="monaco"
value="#{testBean.code}" basename="simple.js"
directory="blutorange/examples"
editorOptions="#{testBean.editorOptions}"
uiLanguage="#{testBean.uiLanguage}" height="400px" width="100%">
</blut:monacoEditor>
<script>log("Monaco updated")</script>
<blut:monacoEditor widgetVar="monaco" id="monaco"
value="#{testBean.code}" basename="simple.js"
directory="blutorange/examples"
editorOptions="#{testBean.editorOptions}"
uiLanguage="#{testBean.uiLanguage}" height="400px" width="100%">
</blut:monacoEditor>
</p:outputPanel>
</p:tab>
</p:tabView>
Expand All @@ -37,11 +37,13 @@
<script>
window.testCase = function() {
log("Click on the 'monaco' tab.");
log("The message 'Monaco updated' should be logged");
log("The editor should be visible, and have height of about 400px.");
log("Now click on the 'dummy' tab, then on the button 'click me'");
log("The message 'pressed button' should be logged");
log("The message 'Monaco updated' should be logged");
log("Click on the 'monaco' tab again.");
log("The editor should be visible again, and still have height of about 400px.");
log("===");
};
</script>
</ui:define>
Expand Down
2 changes: 1 addition & 1 deletion demo/src/main/webapp/test7.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
window.testCase = function() {
log("The following messages should be logged:");
log(" [LocalStorageService] creating");
log(" [LocalStorageService] get codelens/cache2");
log(" [LocalStorageService] get suggest/memories/recentlyUsed");
log(" [LocalStorageService] get codelens/cache");
log("Enter something in the editor that trigger autocompletion; then select a suggestion (eg. $.ajax)");
log("The message following message should be logged:");
log(" [LocalStorageService] store suggest/memories/recentlyUsed");
Expand Down
3 changes: 3 additions & 0 deletions demo/src/main/webapp/test8.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@
log("Go to a new line in the first (top-left) editor, and start entering 'testbar'. This should bring a the function 'testbar' as a suggestion while typing.");
log("Go to a different editor, entering 'testbar' should bring up a suggestion as well")
log("Select language 'fr' and click on update");
log("Only one (1) request should have been made to each of the following URLs:");
log(" /monaco/javax.faces.resource/monacoEditor/locale/fr.js");
log(" /monaco/javax.faces.resource/monacoEditor/editor.js.xhtml");
log("The editors should now be displayed in French: click right to bring up the context menu which should now contain French text");
log("----(END)----")
};
Expand Down
16 changes: 16 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<groupId>com.github.blutorange</groupId>
<artifactId>primefaces.monaco</artifactId>
<version>0.17.2</version>
<version>0.18.0</version>

<properties>
<maven.resources.plugin.version>3.1.0</maven.resources.plugin.version>
Expand All @@ -21,7 +21,7 @@
<maven.clean.plugin.version>3.1.0</maven.clean.plugin.version>
<maven.gpg.plugin.version>1.6</maven.gpg.plugin.version>
<vdldoc.maven.plugin.version>1.0</vdldoc.maven.plugin.version>
<frontend-maven-plugin-version>1.7.6</frontend-maven-plugin-version>
<frontend-maven-plugin-version>1.8.0</frontend-maven-plugin-version>
<closure.compiler.maven.plugin.version>2.9.0</closure.compiler.maven.plugin.version>
<primefaces.version>7.0</primefaces.version>
<nexus.staging.version>1.6.8</nexus.staging.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ public final class Constants {
private Constants() {}

public final static String LIBRARY = "primefaces-blutorange";
public final static String VERSION = "0.17.2";
public final static String VERSION = "0.18.0";
}
11 changes: 7 additions & 4 deletions src/main/js/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ function endsWith(string, suffix) {
return string.substring(this_len - suffix.length, this_len) === suffix;
}

/**
* @return {string} Base URL for resources
*/
function getBaseUrl() {
var res = PrimeFaces.resources.getFacesResource("", "", "0");
var idx = res.lastIndexOf(".xhtml");
Expand Down Expand Up @@ -432,8 +435,8 @@ class ExtMonacoEditor extends PrimeFaces.widget.DeferredWidget {
this.addRefreshListener(() => this.onRefresh());
this.addDestroyListener(() => this.onDestroy());

// Begin loading the editor
this._setup().then(() => {
// Begin loading the editor, but only load one editor at a time
GenericPromiseQueue.add(() => this._setup()).then(() => {
this._fireEvent("initialized");
this.jq.data("initialized", true);
this.setValue(this._editorValue);
Expand Down Expand Up @@ -546,9 +549,9 @@ class ExtMonacoEditor extends PrimeFaces.widget.DeferredWidget {
async _setup() {
const extender = loadExtender(this.options);
this._extenderInstance = extender;
const {forceLibReload, uiLanguageUri} = await GenericPromiseQueue.add(() => loadLanguage(this.options));
const {forceLibReload, uiLanguageUri} = await loadLanguage(this.options);
this._resolvedUiLanguageUri = uiLanguageUri;
const wasLibLoaded = await GenericPromiseQueue.add(() => loadEditorLib(this.options, forceLibReload));
const wasLibLoaded = await loadEditorLib(this.options, forceLibReload);
this.getEditorContainer().empty();
const options = await createEditorConstructionOptions(this, extender, wasLibLoaded);
const editor = await this._renderDeferredAsync({extender, options, wasLibLoaded});
Expand Down

0 comments on commit 267d1f6

Please sign in to comment.