Add get/set content to code editor plugin
Fixes plain text / snippet editor issue Fixes #2059
This commit is contained in:
parent
55e7e1e545
commit
bb5a44ced5
|
|
@ -63,10 +63,20 @@ class CodeEditor extends FormWidgetBase
|
|||
public $margin = 0;
|
||||
|
||||
/**
|
||||
* @var $theme Ace Editor theme to use.
|
||||
* @var string Ace Editor theme to use.
|
||||
*/
|
||||
public $theme = 'twilight';
|
||||
|
||||
/**
|
||||
* @var bool Show invisible characters.
|
||||
*/
|
||||
public $showInvisibles = false;
|
||||
|
||||
/**
|
||||
* @var bool Highlight the active line.
|
||||
*/
|
||||
public $highlightActiveLine = true;
|
||||
|
||||
/**
|
||||
* @var boolean If true, the editor is set to read-only mode
|
||||
*/
|
||||
|
|
@ -119,6 +129,8 @@ class CodeEditor extends FormWidgetBase
|
|||
'fontSize',
|
||||
'margin',
|
||||
'theme',
|
||||
'showInvisibles',
|
||||
'highlightActiveLine',
|
||||
'readOnly',
|
||||
'autocompletion',
|
||||
'enableSnippets',
|
||||
|
|
|
|||
|
|
@ -4713,6 +4713,8 @@ renderer.setPrintMarginColumn(80)
|
|||
break}}
|
||||
CodeEditor.prototype.setTheme=function(theme){var self=this
|
||||
assetManager.load({js:[this.options.vendorPath+'/theme-'+theme+'.js']},function(){self.editor.setTheme('ace/theme/'+theme)})}
|
||||
CodeEditor.prototype.getContent=function(){return this.editor.getSession().getValue()}
|
||||
CodeEditor.prototype.setContent=function(html){this.editor.getSession().setValue(html)}
|
||||
CodeEditor.prototype.getEditorObject=function(){return this.editor}
|
||||
CodeEditor.prototype.getToolbar=function(){return this.$toolbar}
|
||||
CodeEditor.prototype.toggleFullscreen=function(){this.$el.toggleClass('editor-fullscreen')
|
||||
|
|
|
|||
|
|
@ -340,6 +340,14 @@
|
|||
})
|
||||
}
|
||||
|
||||
CodeEditor.prototype.getContent = function() {
|
||||
return this.editor.getSession().getValue()
|
||||
}
|
||||
|
||||
CodeEditor.prototype.setContent = function(html) {
|
||||
this.editor.getSession().setValue(html)
|
||||
}
|
||||
|
||||
CodeEditor.prototype.getEditorObject = function() {
|
||||
return this.editor
|
||||
}
|
||||
|
|
|
|||
7
modules/backend/formwidgets/codeeditor/assets/vendor/ace/snippets/plain_text.js
vendored
Normal file
7
modules/backend/formwidgets/codeeditor/assets/vendor/ace/snippets/plain_text.js
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
ace.define("ace/snippets/plain_text",["require","exports","module"], function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
exports.snippetText =undefined;
|
||||
exports.scope = "plain_text";
|
||||
|
||||
});
|
||||
Loading…
Reference in New Issue