commit 3e21e63a50d67d56f772480f59ed615addf7fb80
parent e4310e5fbb7fe638bb5cb82d9444f9bd21a3e7a7
Author: unitehenry <unitehenry@gmail.com>
Date: Wed, 23 Oct 2019 14:44:42 -0400
Merge branch 'dev'
Diffstat:
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/demo/src/App.vue b/demo/src/App.vue
@@ -10,7 +10,9 @@
style="margin-top: 20px; background-color: #fff; min-height: 300px; width: 600px;"
></div>
</div>
- <div ref="customButton" class="custom-button" @click="sendContent">Send</div>
+ <div ref="customButton" class="custom-button" @click="sendContent">
+ Send
+ </div>
</div>
</template>
@@ -21,10 +23,8 @@ import { StrivenEditor } from "@striven-erp/striven-editor";
export default {
name: "app",
mounted() {
- const toolbarButton = this.$refs.customButton;
-
const editorOptions = {
- // metaUrl: "http://localhost:4200/meta", // metaserver.js
+ metaUrl: "https://mighty-anchorage-82390.herokuapp.com/meta", // metaserver.js
// imageUrl: "http://localhost:4200/image", // imageserver.js
minimal: true,
uploadOnPaste: false,
@@ -41,7 +41,7 @@ export default {
}
this.editor.body.blur();
},
- customToolbarButton: toolbarButton
+ customToolbarButton: this.$refs.customButton
};
this.editor = new StrivenEditor(this.$refs.editor, editorOptions);
diff --git a/src/striveneditor.js b/src/striveneditor.js
@@ -1096,7 +1096,7 @@ export default class StrivenEditor {
}
getContent() {
- return this.body.innerHTML;
+ return this.pruneScripts(this.body).innerHTML;
}
getRange() {
@@ -1142,6 +1142,13 @@ export default class StrivenEditor {
: (body.style.overflowX = "hidden");
}
+ pruneScripts (el) {
+ const scripts = el.querySelectorAll('script');
+ scripts.forEach(script => script.remove());
+
+ return el;
+ }
+
formatBytes(bytes, decimals = 2) {
if (bytes === 0) return '0 Bytes';