mirror of
https://github.com/documize/community.git
synced 2025-07-27 00:59:43 +02:00
WYSIWYG editor now calls Ember parent lifecycle event
Missing ember component event calls added.
This commit is contained in:
parent
1370b2f2b5
commit
f967949513
2 changed files with 91 additions and 82 deletions
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
import $ from 'jquery';
|
import $ from 'jquery';
|
||||||
import { computed, set } from '@ember/object';
|
import { computed, set } from '@ember/object';
|
||||||
|
import { schedule } from '@ember/runloop';
|
||||||
import Component from '@ember/component';
|
import Component from '@ember/component';
|
||||||
import { inject as service } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
|
|
||||||
|
@ -24,25 +25,31 @@ export default Component.extend({
|
||||||
}),
|
}),
|
||||||
|
|
||||||
didReceiveAttrs() {
|
didReceiveAttrs() {
|
||||||
|
this._super(...arguments);
|
||||||
this.set('pageBody', this.get('meta.rawBody'));
|
this.set('pageBody', this.get('meta.rawBody'));
|
||||||
},
|
},
|
||||||
|
|
||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
|
this._super(...arguments);
|
||||||
|
|
||||||
|
schedule('afterRender', () => {
|
||||||
let options = {
|
let options = {
|
||||||
|
cache_suffix: "?v=454",
|
||||||
selector: "#" + this.get('editorId'),
|
selector: "#" + this.get('editorId'),
|
||||||
relative_urls: false,
|
relative_urls: false,
|
||||||
cache_suffix: "?v=475",
|
|
||||||
browser_spellcheck: true,
|
browser_spellcheck: true,
|
||||||
gecko_spellcheck: false,
|
gecko_spellcheck: false,
|
||||||
theme: "modern",
|
|
||||||
skin: 'documize',
|
|
||||||
statusbar: false,
|
statusbar: false,
|
||||||
inline: true,
|
inline: true,
|
||||||
entity_encoding: "raw",
|
// fixed_toolbar_container: '#mytoolbar',
|
||||||
paste_data_images: true,
|
paste_data_images: true,
|
||||||
image_advtab: true,
|
image_advtab: true,
|
||||||
image_caption: true,
|
image_caption: true,
|
||||||
media_live_embeds: 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",
|
fontsize_formats: "8px 10px 12px 14px 17px 18px 24px 36px 40px 50px 60px",
|
||||||
formats: {
|
formats: {
|
||||||
bold: {
|
bold: {
|
||||||
|
@ -87,9 +94,8 @@ export default Component.extend({
|
||||||
{text: 'XML', value: 'markup'},
|
{text: 'XML', value: 'markup'},
|
||||||
{text: 'YAML', value: 'yaml'},
|
{text: 'YAML', value: 'yaml'},
|
||||||
],
|
],
|
||||||
extended_valid_elements: "b,i,b/strong,i/em",
|
|
||||||
plugins: [
|
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',
|
'searchreplace wordcount visualblocks visualchars code codesample fullscreen',
|
||||||
'insertdatetime media nonbreaking save table directionality',
|
'insertdatetime media nonbreaking save table directionality',
|
||||||
'template paste textcolor colorpicker textpattern imagetools'
|
'template paste textcolor colorpicker textpattern imagetools'
|
||||||
|
@ -104,7 +110,7 @@ export default Component.extend({
|
||||||
};
|
};
|
||||||
|
|
||||||
if (typeof tinymce === 'undefined') {
|
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;
|
window.tinymce.dom.Event.domLoaded = true;
|
||||||
tinymce.baseURL = "//" + window.location.host + "/tinymce";
|
tinymce.baseURL = "//" + window.location.host + "/tinymce";
|
||||||
tinymce.suffix = ".min";
|
tinymce.suffix = ".min";
|
||||||
|
@ -113,9 +119,11 @@ export default Component.extend({
|
||||||
} else {
|
} else {
|
||||||
tinymce.init(options);
|
tinymce.init(options);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
willDestroyElement() {
|
willDestroyElement() {
|
||||||
|
this._super(...arguments);
|
||||||
tinymce.EditorManager.execCommand('mceRemoveEditor', true, this.get('editorId'));
|
tinymce.EditorManager.execCommand('mceRemoveEditor', true, this.get('editorId'));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
{{#section/base-editor-inline document=document folder=folder page=page
|
{{#section/base-editor-inline document=document folder=folder page=page
|
||||||
blockMode=blockMode contentLinkerButton=true onInsertLink=(action 'onInsertLink')
|
blockMode=blockMode contentLinkerButton=true onInsertLink=(action 'onInsertLink')
|
||||||
isDirty=(action 'isDirty') onCancel=(action 'onCancel') onAction=(action 'onAction')}}
|
isDirty=(action 'isDirty') onCancel=(action 'onCancel') onAction=(action 'onAction')}}
|
||||||
|
<div id='#mytoolbar'></div>
|
||||||
<div id={{editorId}} class="mousetrap wysiwyg wysiwyg-editor">
|
<div id={{editorId}} class="mousetrap wysiwyg wysiwyg-editor">
|
||||||
{{{pageBody}}}
|
{{{pageBody}}}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue