1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-25 16:19:46 +02:00

WYSIWYG editor now calls Ember parent lifecycle event

Missing ember component event calls added.
This commit is contained in:
sauls8t 2018-02-04 15:50:17 +00:00
parent 1370b2f2b5
commit f967949513
2 changed files with 91 additions and 82 deletions

View file

@ -11,6 +11,7 @@
import $ from 'jquery';
import { computed, set } from '@ember/object';
import { schedule } from '@ember/runloop';
import Component from '@ember/component';
import { inject as service } from '@ember/service';
@ -24,25 +25,31 @@ export default Component.extend({
}),
didReceiveAttrs() {
this._super(...arguments);
this.set('pageBody', this.get('meta.rawBody'));
},
didInsertElement() {
this._super(...arguments);
schedule('afterRender', () => {
let options = {
cache_suffix: "?v=454",
selector: "#" + this.get('editorId'),
relative_urls: false,
cache_suffix: "?v=475",
browser_spellcheck: true,
gecko_spellcheck: false,
theme: "modern",
skin: 'documize',
statusbar: false,
inline: true,
entity_encoding: "raw",
// fixed_toolbar_container: '#mytoolbar',
paste_data_images: true,
image_advtab: true,
image_caption: true,
media_live_embeds: true,
theme: "modern",
skin: 'lightgray-gradient',
entity_encoding: "raw",
extended_valid_elements: "b,i,b/strong,i/em",
fontsize_formats: "8px 10px 12px 14px 17px 18px 24px 36px 40px 50px 60px",
formats: {
bold: {
@ -87,9 +94,8 @@ export default Component.extend({
{text: 'XML', value: 'markup'},
{text: 'YAML', value: 'yaml'},
],
extended_valid_elements: "b,i,b/strong,i/em",
plugins: [
'advlist autolink lists link image charmap print preview hr anchor pagebreak',
'advlist autolink lists link image charmap print hr anchor pagebreak',
'searchreplace wordcount visualblocks visualchars code codesample fullscreen',
'insertdatetime media nonbreaking save table directionality',
'template paste textcolor colorpicker textpattern imagetools'
@ -104,7 +110,7 @@ export default Component.extend({
};
if (typeof tinymce === 'undefined') {
$.getScript("/tinymce/tinymce.min.js?v=443", function () {
$.getScript("/tinymce/tinymce.min.js?v=454", function () {
window.tinymce.dom.Event.domLoaded = true;
tinymce.baseURL = "//" + window.location.host + "/tinymce";
tinymce.suffix = ".min";
@ -113,9 +119,11 @@ export default Component.extend({
} else {
tinymce.init(options);
}
});
},
willDestroyElement() {
this._super(...arguments);
tinymce.EditorManager.execCommand('mceRemoveEditor', true, this.get('editorId'));
},

View file

@ -1,6 +1,7 @@
{{#section/base-editor-inline document=document folder=folder page=page
blockMode=blockMode contentLinkerButton=true onInsertLink=(action 'onInsertLink')
isDirty=(action 'isDirty') onCancel=(action 'onCancel') onAction=(action 'onAction')}}
<div id='#mytoolbar'></div>
<div id={{editorId}} class="mousetrap wysiwyg wysiwyg-editor">
{{{pageBody}}}
</div>