aloha-vue 1.1.5 → 1.1.7

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.
@@ -8,5 +8,9 @@ div
8
8
  :text="'_ADD_NOTIFICATION_{{type}}_'"
9
9
  :extra="{type: type}"
10
10
  @click="addNotificationLocal(type)"
11
- text="Open Modal"
12
11
  )
12
+ .a_mt_4
13
+ a-button.a_btn.a_btn_primary(
14
+ text="Object"
15
+ @click="addNotificationLocal({ sdf: 'x', abc: 'y', aloha: 'z' })"
16
+ )
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.5",
17
+ "version": "1.1.7",
18
18
  "author": {
19
19
  "name": "Ilia Brykin",
20
20
  "email": "brykin.ilia@gmail.com"
@@ -3,8 +3,12 @@ import {
3
3
  ref,
4
4
  } from "vue";
5
5
 
6
+ import {
7
+ createListFromObject,
8
+ } from "../utils/utils";
6
9
  import {
7
10
  isNil,
11
+ isPlainObject,
8
12
  values,
9
13
  } from "lodash-es";
10
14
 
@@ -28,13 +32,17 @@ export function setNotificationTimeout(timeout) {
28
32
  notificationTimeout = timeout;
29
33
  }
30
34
 
31
- export function addNotification({ text, type = "success", timeout }) {
35
+ export function addNotification({ text, type = "success", timeout, useValuesFromObject = true }) {
32
36
  const TIMEOUT_LOCAL = isNil(timeout) ? notificationTimeout : timeout;
33
37
  const CURRENT_INDEX = notificationsCount;
34
38
  const TYPE = type === "error" ? "danger" : type;
39
+ let textLocal = text;
40
+ if (isPlainObject(text) && useValuesFromObject) {
41
+ textLocal = createListFromObject(text); // TODO: filterList
42
+ }
35
43
 
36
44
  notificationsObj.value[CURRENT_INDEX] = {
37
- text,
45
+ text: textLocal,
38
46
  type: TYPE,
39
47
  index: CURRENT_INDEX,
40
48
  };
@@ -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: "a[href|target=_blank],strong/b,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", () => {
@@ -47,3 +47,13 @@ export function concatenateTwoStringsWithSpace({ class1, class2, defaultValue =
47
47
  }
48
48
  return defaultValue;
49
49
  }
50
+
51
+ export function createListFromObject(obj) { // TODO: filterList, soll gelöscht werden
52
+ const keys = Object.keys(obj);
53
+ if (keys.length === 0) {
54
+ return "";
55
+ }
56
+
57
+ const items = keys.map(key => `<li>${ obj[key] }</li>`).join("");
58
+ return `<ul class="a_list_without_styles">${ items }</ul>`;
59
+ }