From 1055263eaa442c98eb6c6d6b38f0a4a6d0f3a69b Mon Sep 17 00:00:00 2001 From: szymon Date: Fri, 15 Jul 2022 14:51:30 +0200 Subject: [PATCH] filemamanger concept --- src/components/plugin/SectionTextarea.vue | 16 +++++++++++----- src/components/tinymce/config.js | 7 ++++--- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/components/plugin/SectionTextarea.vue b/src/components/plugin/SectionTextarea.vue index 2d411af..9ded033 100644 --- a/src/components/plugin/SectionTextarea.vue +++ b/src/components/plugin/SectionTextarea.vue @@ -44,7 +44,7 @@ export default { this.text = (this.value && this.value.text) ? this.value.text : this.text; if (this.value.open) this.modalBox = true; console.log('mounted textarea'); - this.$emit('input',this.value); + this.$emit('input', this.value); }, data: function () { @@ -58,11 +58,17 @@ export default { modalBox: false, text: '', name: 'core_section_textarea', - vtinymce: tinymceConfig, + vtinymce: Object.assign(tinymceConfig, { + file_picker_callback: (callback, value, meta) => { + if (this.$filemanager) { + this.$filemanager.fileChooser(callback, value, meta) + } + } + }), } }, watch: { - modalBox: function() { + modalBox: function () { if (this.modalBox) { document.addEventListener('focusin', (e) => { if (e.target.closest(".tox-tinymce-aux, .moxman-window, .tam-assetmanager-root") !== null) { @@ -70,12 +76,12 @@ export default { } }); } - console.log('focus'); + console.log('focus'); }, }, computed: { ctext: function () { - return this.value.text?this.value.text.replace(/<(?:.|\n)*?>/gm, ''):''; + return this.value.text ? this.value.text.replace(/<(?:.|\n)*?>/gm, '') : ''; } }, methods: { diff --git a/src/components/tinymce/config.js b/src/components/tinymce/config.js index 3089142..4c185a4 100644 --- a/src/components/tinymce/config.js +++ b/src/components/tinymce/config.js @@ -3,7 +3,7 @@ export default { width: '100%', selector: "textarea.wysiwyg", language: "pl", - language_url:'https://www.magico.pl/assets/js/tinymce/langs/pl.js', + language_url: 'https://www.magico.pl/assets/js/tinymce/langs/pl.js', forced_root_block: "p", entity_encoding: 'named', entities: '160,nbsp,38,amp,60,lt,62,gt', @@ -106,10 +106,11 @@ export default { valid_styles: { '*': 'display, margin, float, margin-left, margin-right, margin-top, margin-bottom, padding-left, padding-right, padding-top, padding-bottom, text-decoration, border,font-size,color,background,background-color,line-height,text-align,list-style-type, border-radius', }, - plugins: ['advlist', 'autolink', 'lists', 'link', 'image', 'print', 'hr', 'anchor', 'media', 'pagebreak' ,'searchreplace', 'wordcount', 'visualblocks', 'visualchars', 'code' ,'insertdatetime', 'nonbreaking', 'save', 'table', 'contextmenu', 'directionality' ,'emoticons', 'paste', 'textcolor', 'textpattern', 'codesample', 'charmap', 'autoresize'], + plugins: ['advlist', 'autolink', 'lists', 'link', 'image', 'print', 'hr', 'anchor', 'media', 'pagebreak', 'searchreplace', 'wordcount', 'visualblocks', 'visualchars', 'code', 'insertdatetime', 'nonbreaking', 'save', 'table', 'contextmenu', 'directionality', 'emoticons', 'paste', 'textcolor', 'textpattern', 'codesample', 'charmap', 'autoresize'], removed_menuitems: 'newdocument', toolbarxx: "undo redo | bold italic | bullist numlist outdent indent | alignleft aligncenter alignright alignjustify | link image forecolor backcolor", toolbar1: 'undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | media | forecolor backcolor', toolbar2: '', - menubar:true, + menubar: true, + } \ No newline at end of file