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:
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,98 +25,105 @@ 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() {
|
||||||
let options = {
|
this._super(...arguments);
|
||||||
selector: "#" + this.get('editorId'),
|
|
||||||
relative_urls: false,
|
schedule('afterRender', () => {
|
||||||
cache_suffix: "?v=475",
|
let options = {
|
||||||
browser_spellcheck: true,
|
cache_suffix: "?v=454",
|
||||||
gecko_spellcheck: false,
|
selector: "#" + this.get('editorId'),
|
||||||
theme: "modern",
|
relative_urls: false,
|
||||||
skin: 'documize',
|
browser_spellcheck: true,
|
||||||
statusbar: false,
|
gecko_spellcheck: false,
|
||||||
inline: true,
|
statusbar: false,
|
||||||
entity_encoding: "raw",
|
inline: true,
|
||||||
paste_data_images: true,
|
// fixed_toolbar_container: '#mytoolbar',
|
||||||
image_advtab: true,
|
paste_data_images: true,
|
||||||
image_caption: true,
|
image_advtab: true,
|
||||||
media_live_embeds: true,
|
image_caption: true,
|
||||||
fontsize_formats: "8px 10px 12px 14px 17px 18px 24px 36px 40px 50px 60px",
|
media_live_embeds: true,
|
||||||
formats: {
|
theme: "modern",
|
||||||
bold: {
|
skin: 'lightgray-gradient',
|
||||||
inline: 'b'
|
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: {
|
||||||
|
inline: 'b'
|
||||||
|
},
|
||||||
|
italic: {
|
||||||
|
inline: 'i'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
italic: {
|
codesample_languages: [
|
||||||
inline: 'i'
|
{text: 'C', value: 'c'},
|
||||||
|
{text: 'C#', value: 'csharp'},
|
||||||
|
{text: 'C++', value: 'cpp'},
|
||||||
|
{text: 'CSS', value: 'css'},
|
||||||
|
{text: 'Docker', value: 'docker'},
|
||||||
|
{text: 'Elixir', value: 'elixir'},
|
||||||
|
{text: 'Erlang', value: 'erlang'},
|
||||||
|
{text: 'Fsharp', value: 'fsharp'},
|
||||||
|
{text: 'Git', value: 'git'},
|
||||||
|
{text: 'Go', value: 'go'},
|
||||||
|
{text: 'Haskell', value: 'haskell'},
|
||||||
|
{text: 'HTML', value: 'markup'},
|
||||||
|
{text: 'HTTP', value: 'http'},
|
||||||
|
{text: 'Java', value: 'java'},
|
||||||
|
{text: 'JavaScript', value: 'javascript'},
|
||||||
|
{text: 'JSON', value: 'json'},
|
||||||
|
{text: 'Less', value: 'less'},
|
||||||
|
{text: 'Makefile', value: 'makefile'},
|
||||||
|
{text: 'Markdown', value: 'markdown'},
|
||||||
|
{text: 'nginx', value: 'nginx'},
|
||||||
|
{text: 'Objective C', value: 'objectivec'},
|
||||||
|
{text: 'Perl', value: 'perl'},
|
||||||
|
{text: 'PHP', value: 'php'},
|
||||||
|
{text: 'Powershell', value: 'powershell'},
|
||||||
|
{text: 'Python', value: 'python'},
|
||||||
|
{text: 'Ruby', value: 'ruby'},
|
||||||
|
{text: 'Rust', value: 'rust'},
|
||||||
|
{text: 'Sass SCSS', value: 'scss'},
|
||||||
|
{text: 'SQL', value: 'sql'},
|
||||||
|
{text: 'Swift', value: 'swift'},
|
||||||
|
{text: 'TypeScript', value: 'typescript'},
|
||||||
|
{text: 'XML', value: 'markup'},
|
||||||
|
{text: 'YAML', value: 'yaml'},
|
||||||
|
],
|
||||||
|
plugins: [
|
||||||
|
'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'
|
||||||
|
],
|
||||||
|
menu: {},
|
||||||
|
menubar: false,
|
||||||
|
toolbar1: "formatselect fontsizeselect | bold italic underline strikethrough superscript subscript | forecolor backcolor link unlink",
|
||||||
|
toolbar2: "outdent indent bullist numlist | alignleft aligncenter alignright alignjustify | table image media codesample",
|
||||||
|
save_onsavecallback: function () {
|
||||||
|
Mousetrap.trigger('ctrl+s');
|
||||||
}
|
}
|
||||||
},
|
};
|
||||||
codesample_languages: [
|
|
||||||
{text: 'C', value: 'c'},
|
if (typeof tinymce === 'undefined') {
|
||||||
{text: 'C#', value: 'csharp'},
|
$.getScript("/tinymce/tinymce.min.js?v=454", function () {
|
||||||
{text: 'C++', value: 'cpp'},
|
window.tinymce.dom.Event.domLoaded = true;
|
||||||
{text: 'CSS', value: 'css'},
|
tinymce.baseURL = "//" + window.location.host + "/tinymce";
|
||||||
{text: 'Docker', value: 'docker'},
|
tinymce.suffix = ".min";
|
||||||
{text: 'Elixir', value: 'elixir'},
|
tinymce.init(options);
|
||||||
{text: 'Erlang', value: 'erlang'},
|
});
|
||||||
{text: 'Fsharp', value: 'fsharp'},
|
} else {
|
||||||
{text: 'Git', value: 'git'},
|
|
||||||
{text: 'Go', value: 'go'},
|
|
||||||
{text: 'Haskell', value: 'haskell'},
|
|
||||||
{text: 'HTML', value: 'markup'},
|
|
||||||
{text: 'HTTP', value: 'http'},
|
|
||||||
{text: 'Java', value: 'java'},
|
|
||||||
{text: 'JavaScript', value: 'javascript'},
|
|
||||||
{text: 'JSON', value: 'json'},
|
|
||||||
{text: 'Less', value: 'less'},
|
|
||||||
{text: 'Makefile', value: 'makefile'},
|
|
||||||
{text: 'Markdown', value: 'markdown'},
|
|
||||||
{text: 'nginx', value: 'nginx'},
|
|
||||||
{text: 'Objective C', value: 'objectivec'},
|
|
||||||
{text: 'Perl', value: 'perl'},
|
|
||||||
{text: 'PHP', value: 'php'},
|
|
||||||
{text: 'Powershell', value: 'powershell'},
|
|
||||||
{text: 'Python', value: 'python'},
|
|
||||||
{text: 'Ruby', value: 'ruby'},
|
|
||||||
{text: 'Rust', value: 'rust'},
|
|
||||||
{text: 'Sass SCSS', value: 'scss'},
|
|
||||||
{text: 'SQL', value: 'sql'},
|
|
||||||
{text: 'Swift', value: 'swift'},
|
|
||||||
{text: 'TypeScript', value: 'typescript'},
|
|
||||||
{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',
|
|
||||||
'searchreplace wordcount visualblocks visualchars code codesample fullscreen',
|
|
||||||
'insertdatetime media nonbreaking save table directionality',
|
|
||||||
'template paste textcolor colorpicker textpattern imagetools'
|
|
||||||
],
|
|
||||||
menu: {},
|
|
||||||
menubar: false,
|
|
||||||
toolbar1: "formatselect fontsizeselect | bold italic underline strikethrough superscript subscript | forecolor backcolor link unlink",
|
|
||||||
toolbar2: "outdent indent bullist numlist | alignleft aligncenter alignright alignjustify | table image media codesample",
|
|
||||||
save_onsavecallback: function () {
|
|
||||||
Mousetrap.trigger('ctrl+s');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (typeof tinymce === 'undefined') {
|
|
||||||
$.getScript("/tinymce/tinymce.min.js?v=443", function () {
|
|
||||||
window.tinymce.dom.Event.domLoaded = true;
|
|
||||||
tinymce.baseURL = "//" + window.location.host + "/tinymce";
|
|
||||||
tinymce.suffix = ".min";
|
|
||||||
tinymce.init(options);
|
tinymce.init(options);
|
||||||
});
|
}
|
||||||
} else {
|
});
|
||||||
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