| Summary: | codeEdit: Need to pass the editor options during the create() API call. | ||
|---|---|---|---|
| Product: | [ECD] Orion | Reporter: | libing wang <libingw> |
| Component: | Client | Assignee: | libing wang <libingw> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | 10.0 | ||
| Target Milestone: | 12.0 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
The new option object is called editorConfig. If the editorConfig option is not defined then there is a default editorConfig object loaded in the widget itself:
var defaults = {
autoSave: true,
autoSaveVisible: true,
autoSaveLocalVisible: true,
autoSaveTimeout: 250,
autoSaveTimeoutVisible: true,
themeVisible: true,
themeLocalVisible: true,
fontSizeVisible: true,
fontSizeLocalVisible: true,
autoLoad: true,
autoLoadVisible: true,
saveDiffs: true,
saveDiffsVisible: true,
contentAssistAutoTrigger: true,
contentAssistAutoTriggerVisible: true,
showOccurrences: true,
showOccurrencesVisible: true,
autoPairParentheses: true,
autoPairParenthesesVisible: true,
autoPairBraces: true,
autoPairBracesVisible: true,
autoPairSquareBrackets: true,
autoPairSquareBracketsVisible: true,
autoPairAngleBrackets: false,
autoPairAngleBracketsVisible: true,
autoPairQuotations: true,
autoPairQuotationsVisible: true,
autoCompleteComments: true,
autoCompleteCommentsVisible: true,
smartIndentation: true,
smartIndentationVisible: true,
trimTrailingWhiteSpace: false,
trimTrailingWhiteSpaceVisible: true,
tabSize: 4,
tabSizeVisible: true,
expandTab: false,
expandTabVisible: true,
scrollAnimation: true,
scrollAnimationVisible: true,
scrollAnimationTimeout: 300,
scrollAnimationTimeoutVisible: true,
annotationRuler: true,
annotationRulerVisible: true,
lineNumberRuler: true,
lineNumberRulerVisible: true,
foldingRuler: true,
foldingRulerVisible: true,
overviewRuler: true,
overviewRulerVisible: true,
zoomRuler: false,
zoomRulerVisible: true,
zoomRulerLocalVisible: true,
showWhitespaces: false,
showWhitespacesVisible: true,
wordWrap: false,
wordWrapVisible: true,
showMargin: false,
showMarginVisible: true,
marginOffset: 80,
marginOffsetVisible: true,
keyBindings: "Default",
keyBindingsVisible: true,
keyBindingsLocalVisible: true,
diffService: false,
diffServiceVisible: false
};
The code pattern for passing the editorConfig to the widget will be:
var embeddedEditor = new mEmbeddedEditor({
editorConfig: {showWhitespaces: true, zoomRuler: true}
});
embeddedEditor.create(...).then(function(editorViewer1){});
embeddedEditor.create(...).then(function(editorViewer2){});
Note that editorViewer1 and editorViewer2 will use the same editor config.
|
Currently when the widget create() API is called, there is no way to pass the editor options in. Users have to use editorViewer.editor API calls after the creation but as the editorViewer.setContents call is async so some of the editorViewer.editor APIs calls could be overwritten by the promise from the editorViewer.setContents call. An example is editorViewer.editor.getTextView().setOptions({"readonly": true});