Skip to content

Commit

Permalink
Make media selection work and add more plugins and tools
Browse files Browse the repository at this point in the history
  • Loading branch information
henk23 authored and knadh committed Sep 23, 2021
1 parent c140578 commit 1e4f974
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 56 deletions.
49 changes: 7 additions & 42 deletions frontend/src/assets/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ section {
left: 0;
position: static;
}
}
}
}

.box {
Expand Down Expand Up @@ -205,44 +205,9 @@ body.is-noscroll {
border: 1px solid $grey-lighter;
border-radius: 2px;
}
.quill-editor {
background: #fff;
&.fullscreen {
position: fixed;
top: 10px;
right: 10px;
bottom: 10px;
left: 10px;
z-index: 100;
}
.ql-fullscreen:after {
content: "";
font-weight: 600;
font-size: 1.2rem;
line-height: 0.95rem;
}
.ql-toolbar.ql-snow .ql-picker.ql-size {
.ql-picker-item[data-value="11px"]::before {
content: 'Small';
font-size: 11px !important;
}
.ql-picker-item[data-value="13px"]::before {
content: 'Normal';
font-size: 13px !important;
}
.ql-picker-item[data-value="22px"]::before {
content: 'Big';
font-size: 20px !important;
}
.ql-picker-item[data-value="32px"]::before {
content: 'Huge';
font-size: 32px !important;
}
}
}

.editor {
margin-bottom: 30px;
margin-bottom: 30px;
}
.plain-editor textarea {
height: 65vh;
Expand Down Expand Up @@ -276,7 +241,7 @@ body.is-noscroll {

/* Modal */
.modal {
z-index: 100;
z-index: 1350; // Needs to get above the TinyMCE modal
}
.modal-card-head {
display: block;
Expand Down Expand Up @@ -433,7 +398,7 @@ body.is-noscroll {
background: #fff1f0;
border: 1px solid lighten($color, 30%);
box-shadow: 1px 1px 0 lighten($color, 30%);
}
}

sup {
font-weight: $weight-semibold;
Expand All @@ -445,7 +410,7 @@ body.is-noscroll {
&.confirmed sup {
color: #52c41a;
}

&:not(body) .icon:first-child:last-child {
margin-right: 1px;
}
Expand Down Expand Up @@ -615,7 +580,7 @@ section.analytics {
/* Campaign / template preview popup */
.preview {
padding: 0;

/* Contain the spinner background in the content area. */
position: relative;

Expand Down Expand Up @@ -789,7 +754,7 @@ section.campaign {
}
.slide-leave-active, .slide-leave-to {
transition: none;
display: none;
display: none;
}


Expand Down
60 changes: 46 additions & 14 deletions frontend/src/components/Editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,27 @@ import 'tinymce';
import 'tinymce/icons/default';
import 'tinymce/themes/silver';
import 'tinymce/skins/ui/oxide/skin.css';
import 'tinymce/plugins/charmap';
import 'tinymce/plugins/code';
import 'tinymce/plugins/colorpicker';
import 'tinymce/plugins/contextmenu';
import 'tinymce/plugins/emoticons';
import 'tinymce/plugins/emoticons/js/emojis';
import 'tinymce/plugins/fullscreen';
import 'tinymce/plugins/help';
import 'tinymce/plugins/hr';
import 'tinymce/plugins/image';
import 'tinymce/plugins/imagetools';
import 'tinymce/plugins/link';
import 'tinymce/plugins/lists';
import 'tinymce/plugins/paste';
import 'tinymce/plugins/searchreplace';
import 'tinymce/plugins/table';
import 'tinymce/plugins/hr';
import 'tinymce/plugins/textcolor';
import 'tinymce/plugins/visualblocks';
import 'tinymce/plugins/visualchars';
import 'tinymce/plugins/wordcount';
import 'tinymce/plugins/charmap';
import 'tinymce/plugins/image';
import 'tinymce/plugins/anchor';
import 'tinymce/plugins/fullscreen';
import TinyMce from '@tinymce/tinymce-vue';
import CampaignPreview from './CampaignPreview.vue';
Expand Down Expand Up @@ -136,16 +147,33 @@ export default {
// TODO: Possibility to overwrite this config from an external source for easy customization
tinyMceOptions: {
// TODO: To use `language`, you have to download your desired language pack here:
// https://www.tiny.cloud/get-tiny/language-packages/, then somehow copy it into /frontend/js/langs/
language: this.$t('settings.general.language'),
height: 400,
height: 500,
plugins: [
'lists', 'link', 'image', 'charmap', 'anchor',
'fullscreen', 'table', 'code', 'wordcount', 'hr',
'charmap',
'code',
'emoticons',
'fullscreen',
'help',
'hr',
'image',
'imagetools',
'link',
'lists',
'paste',
'searchreplace',
'table',
'visualblocks',
'visualchars',
'wordcount',
],
// TODO: As a default config, max out all the plugins and toolbars
toolbar: 'undo redo | formatselect fontsizeselect | bold italic backcolor | '
toolbar: 'undo redo | formatselect styleselect fontsizeselect | '
+ 'bold italic underline strikethrough forecolor backcolor subscript superscript | '
+ 'alignleft aligncenter alignright alignjustify | '
+ 'bullist numlist table | outdent indent | removeformat | link hr',
+ 'bullist numlist table image | outdent indent | link hr removeformat | '
+ 'code fullscreen help',
skin: false,
content_css: false,
// TODO: Get the `content_style` from an external source (to match the template styles)
Expand All @@ -154,6 +182,11 @@ export default {
+ 'img { max-width: 100%; }'
+ 'a { color: #0055d4; }'
+ 'a:hover { color: #111; }',
file_picker_types: 'image',
file_picker_callback: (callback) => {
this.isMediaVisible = true;
this.runTinyMceImageCallback = callback;
},
},
};
},
Expand Down Expand Up @@ -222,9 +255,8 @@ export default {
this.isPreviewing = !this.isPreviewing;
},
onMediaSelect(m) {
// TODO: Embed image to TinyMce
console.log('onMediaSelect', m);
onMediaSelect(media) {
this.runTinyMceImageCallback(media.url);
},
beautifyHTML(str) {
Expand Down

0 comments on commit 1e4f974

Please sign in to comment.