use innerText instead of innerHtml to read the contents of the editor parent.
This commit is contained in:
parent
b5a665c33e
commit
46cbba5203
4 changed files with 9 additions and 8 deletions
|
|
@ -134,10 +134,10 @@ copy({
|
||||||
//filter: copy.filter.uglifyjs,
|
//filter: copy.filter.uglifyjs,
|
||||||
dest: 'build/ace.js'
|
dest: 'build/ace.js'
|
||||||
});
|
});
|
||||||
copy({
|
//copy({
|
||||||
source: data,
|
// source: data,
|
||||||
dest: 'build/ace-uncompressed.js'
|
// dest: 'build/ace-uncompressed.js'
|
||||||
});
|
//});
|
||||||
|
|
||||||
copy({
|
copy({
|
||||||
source: [
|
source: [
|
||||||
|
|
@ -151,7 +151,7 @@ copy({
|
||||||
copy({
|
copy({
|
||||||
source: "lib/ace/worker/worker.js",
|
source: "lib/ace/worker/worker.js",
|
||||||
filter: [function(data) {
|
filter: [function(data) {
|
||||||
return data + "\nimportScripts('ace-uncompressed.js')";
|
return data + "\nimportScripts('ace.js')";
|
||||||
}],
|
}],
|
||||||
dest: 'build/worker.js'
|
dest: 'build/worker.js'
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ if (window.document) {
|
||||||
require("pilot/settings");
|
require("pilot/settings");
|
||||||
|
|
||||||
var Event = require("pilot/event");
|
var Event = require("pilot/event");
|
||||||
|
var Dom = require("pilot/dom");
|
||||||
var EditSession = require("ace/edit_session").EditSession;
|
var EditSession = require("ace/edit_session").EditSession;
|
||||||
var JavaScriptMode = require("ace/mode/javascript").Mode;
|
var JavaScriptMode = require("ace/mode/javascript").Mode;
|
||||||
var UndoManager = require("ace/undomanager").UndoManager;
|
var UndoManager = require("ace/undomanager").UndoManager;
|
||||||
|
|
@ -59,7 +60,7 @@ if (window.document) {
|
||||||
el = document.getElementById(el);
|
el = document.getElementById(el);
|
||||||
}
|
}
|
||||||
|
|
||||||
var doc = new EditSession(el.innerHTML);
|
var doc = new EditSession(Dom.getInnerText(el));
|
||||||
doc.setMode(new JavaScriptMode());
|
doc.setMode(new JavaScriptMode());
|
||||||
doc.setUndoManager(new UndoManager());
|
doc.setUndoManager(new UndoManager());
|
||||||
el.innerHTML = '';
|
el.innerHTML = '';
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
}
|
}
|
||||||
}</div>
|
}</div>
|
||||||
|
|
||||||
<script src="ace-uncompressed.js" type="text/javascript" charset="utf-8"></script>
|
<script src="ace.js" type="text/javascript" charset="utf-8"></script>
|
||||||
<script src="theme/twilight.js" type="text/javascript" charset="utf-8"></script>
|
<script src="theme/twilight.js" type="text/javascript" charset="utf-8"></script>
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener("DOMContentLoaded", function() {
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
|
|
|
||||||
|
|
@ -643,7 +643,7 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.setCompositionText = function(text) {
|
this.setCompositionText = function(text) {
|
||||||
this.$composition.innerText = this.$composition.textContent = text;
|
dom.setInnerText(this.$composition, text);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.hideComposition = function() {
|
this.hideComposition = function() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue