aloha-vue 1.1.6 → 1.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "Vue.js"
15
15
  ],
16
16
  "homepage": "https://github.com/ilia-brykin/aloha/#README.md",
17
- "version": "1.1.6",
17
+ "version": "1.1.8",
18
18
  "author": {
19
19
  "name": "Ilia Brykin",
20
20
  "email": "brykin.ilia@gmail.com"
@@ -0,0 +1,48 @@
1
+ import {
2
+ ref,
3
+ } from "vue";
4
+
5
+ export const tinymcePluginOptions = ref({
6
+ propsDefault: {
7
+ branding: true,
8
+ contentCustomStyle: undefined,
9
+ contentLangs: [
10
+ { title: "English", code: "en" },
11
+ { title: "Spanish", code: "es" },
12
+ { title: "French", code: "fr" },
13
+ { title: "Deutsch", code: "de" },
14
+ { title: "Portuguese", code: "pt" },
15
+ { title: "Chinese", code: "zh" },
16
+ ],
17
+ languageDefault: "de",
18
+ maxlength: undefined,
19
+ menu: undefined,
20
+ menubar: false,
21
+ plugins: "advlist code emoticons link lists table help",
22
+ promotion: false,
23
+ rows: undefined,
24
+ toolbar: [
25
+ { name: "Formatierung", items: ["bold", "italic", "underline"] },
26
+ { name: "Ausrichtung", items: ["alignleft", "aligncenter", "alignright", "alignjustify"] },
27
+ { name: "Liste", items: ["bullist", "numlist"] },
28
+ { name: "Einrücken", items: ["indent", "outdent"] },
29
+ { name: "Sprache", items: ["language"] },
30
+ { name: "Link", items: ["link", "unlink"] },
31
+ { name: "Historie", items: ["undo", "redo"] },
32
+ { name: "Hilfe", items: ["help"] },
33
+ ],
34
+ toolbarMode: "wrap",
35
+ validElements: "@[style],a[href|target|title],strong/b,em/i,div,br,p,span,ul,ol,li,table,thead,tbody,th,tr,td",
36
+ },
37
+ });
38
+
39
+ export default {
40
+ install: (app, {
41
+ propsDefault = {},
42
+ } = {}) => {
43
+ tinymcePluginOptions.value.propsDefault = {
44
+ ...tinymcePluginOptions.value.propsDefault,
45
+ ...propsDefault,
46
+ };
47
+ },
48
+ };
@@ -17,6 +17,10 @@ import ATinymceAPI from "./compositionAPI/ATinymceAPI";
17
17
  import UiAPI from "../compositionApi/UiAPI";
18
18
  import UiStyleHideAPI from "../compositionApi/UiStyleHideAPI";
19
19
 
20
+ import {
21
+ tinymcePluginOptions,
22
+ } from "../../plugins/ATinymcePlugin";
23
+
20
24
  export default {
21
25
  name: "ATinymce",
22
26
  mixins: [
@@ -26,71 +30,62 @@ export default {
26
30
  branding: {
27
31
  type: Boolean,
28
32
  required: false,
29
- default: true,
33
+ default: () => tinymcePluginOptions.value.propsDefault.branding,
34
+ },
35
+ contentCustomStyle: {
36
+ type: String,
37
+ required: false,
38
+ default: () => tinymcePluginOptions.value.propsDefault.contentCustomStyle,
30
39
  },
31
40
  contentLangs: {
32
41
  type: Array,
33
42
  required: false,
34
- default: () => [
35
- { title: "English", code: "en" },
36
- { title: "Spanish", code: "es" },
37
- { title: "French", code: "fr" },
38
- { title: "Deutsch", code: "de" },
39
- { title: "Portuguese", code: "pt" },
40
- { title: "Chinese", code: "zh" },
41
- ],
43
+ default: () => tinymcePluginOptions.value.propsDefault.contentLangs,
42
44
  },
43
45
  languageDefault: {
44
46
  type: String,
45
47
  required: false,
46
- default: "de",
48
+ default: () => tinymcePluginOptions.value.propsDefault.languageDefault,
47
49
  },
48
50
  maxlength: {
49
51
  type: [String, Number],
50
52
  required: false,
53
+ default: () => tinymcePluginOptions.value.propsDefault.maxlength,
51
54
  },
52
55
  menu: {
53
56
  type: Object,
54
57
  required: false,
55
- default: undefined,
58
+ default: () => tinymcePluginOptions.value.propsDefault.menu,
56
59
  },
57
60
  menubar: {
58
61
  type: [String, Boolean],
59
62
  required: false,
60
- default: false,
63
+ default: () => tinymcePluginOptions.value.propsDefault.menubar,
61
64
  },
62
65
  plugins: {
63
66
  type: String,
64
67
  required: false,
65
- default: "advlist code emoticons link lists table help",
68
+ default: () => tinymcePluginOptions.value.propsDefault.plugins,
66
69
  },
67
70
  promotion: {
68
71
  type: Boolean,
69
72
  required: false,
70
- default: false,
73
+ default: () => tinymcePluginOptions.value.propsDefault.promotion,
71
74
  },
72
75
  rows: {
73
76
  type: [String, Number],
74
77
  required: false,
78
+ default: () => tinymcePluginOptions.value.propsDefault.rows,
75
79
  },
76
80
  toolbar: {
77
81
  type: [String, Object, Array],
78
82
  required: false,
79
- default: () => ([
80
- { name: "Formatierung", items: ["bold", "italic", "underline"] },
81
- { name: "Ausrichtung", items: ["alignleft", "aligncenter", "alignright", "alignjustify"] },
82
- { name: "Liste", items: ["bullist", "numlist"] },
83
- { name: "Einrücken", items: ["indent", "outdent"] },
84
- { name: "Sprache", items: ["language"] },
85
- { name: "Link", items: ["link", "unlink"] },
86
- { name: "Historie", items: ["undo", "redo"] },
87
- { name: "Hilfe", items: ["help"] },
88
- ]),
83
+ default: () => tinymcePluginOptions.value.propsDefault.toolbar,
89
84
  },
90
85
  toolbarMode: {
91
86
  type: String,
92
87
  required: false,
93
- default: "wrap",
88
+ default: () => tinymcePluginOptions.value.propsDefault.toolbarMode,
94
89
  validator: value => ["floating", "sliding", "scrolling", "wrap"].indexOf(value) !== -1,
95
90
  },
96
91
  type: {
@@ -98,6 +93,11 @@ export default {
98
93
  required: false,
99
94
  default: "tinymce",
100
95
  },
96
+ validElements: {
97
+ type: String,
98
+ required: false,
99
+ default: () => tinymcePluginOptions.value.propsDefault.validElements,
100
+ },
101
101
  },
102
102
  setup(props, context) {
103
103
  const {
@@ -45,20 +45,26 @@ export default function ATinymceAPI(props, context, {
45
45
  htmlIdLocal = computed(() => ""),
46
46
  }) {
47
47
  const branding = toRef(props, "branding");
48
+ const contentCustomStyle = toRef(props, "contentCustomStyle");
48
49
  const contentLangs = toRef(props, "contentLangs");
49
50
  const disabled = toRef(props, "disabled");
50
51
  const languageDefault = toRef(props, "languageDefault");
51
52
  const menu = toRef(props, "menu");
52
53
  const menubar = toRef(props, "menubar");
54
+ const modelValue = toRef(props, "modelValue");
53
55
  const plugins = toRef(props, "plugins");
54
56
  const promotion = toRef(props, "promotion");
55
57
  const toolbar = toRef(props, "toolbar");
56
58
  const toolbarMode = toRef(props, "toolbarMode");
57
- const modelValue = toRef(props, "modelValue");
59
+ const validElements = toRef(props, "validElements");
58
60
 
59
61
  let vueEditor = null;
60
62
  let modelValueLocal = undefined;
61
63
 
64
+ const contentStyle = computed(() => {
65
+ return `${ contentUiSkinCss.toString() }\n${ contentCss.toString() }\n${ contentCustomStyle.value ? contentCustomStyle.value : "" }`;
66
+ });
67
+
62
68
  const changeModelLocal = ({ model }) => {
63
69
  modelValueLocal = model;
64
70
  changeModel({ model });
@@ -74,7 +80,7 @@ export default function ATinymceAPI(props, context, {
74
80
  skin: false,
75
81
  content_css: false,
76
82
  entity_encoding: "raw",
77
- content_style: `${ contentUiSkinCss.toString() }\n${ contentCss.toString() }`,
83
+ content_style: contentStyle.value,
78
84
  branding: branding.value,
79
85
  promotion: promotion.value,
80
86
  language: languageDefault.value,
@@ -82,6 +88,7 @@ export default function ATinymceAPI(props, context, {
82
88
  menu: menu.value,
83
89
  menubar: menubar.value,
84
90
  readonly: !!disabled.value,
91
+ valid_elements: validElements.value,
85
92
  setup: editor => {
86
93
  vueEditor = editor;
87
94
  editor.on("change input undo redo", () => {