@mapomodule/uikit 1.0.0-alpha.37 → 1.0.0-alpha.38

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.
Files changed (32) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/components/Detail/Detail.vue +1 -1
  3. package/components/Detail/DetailLangSwitch.vue +5 -0
  4. package/components/Form/Form.vue +2 -2
  5. package/components/Form/FormField.vue +67 -51
  6. package/components/Form/FormGroup.vue +32 -2
  7. package/components/Form/FormTabs.vue +32 -1
  8. package/components/Form/fields/ColorField.vue +1 -1
  9. package/components/Form/fields/MediaField.vue +1 -1
  10. package/components/Form/fields/wygEditor/defaults.js +20 -52
  11. package/components/Form/fields/wygEditor/wygEditor.vue +48 -19
  12. package/components/MediaManager/MediaBreadcrumbs.vue +3 -2
  13. package/components/MediaManager/MediaFolders.vue +2 -41
  14. package/components/layout/Sidebar/Sidebar.vue +38 -10
  15. package/components/layout/Sidebar/SidebarList.vue +4 -6
  16. package/components/layout/Sidebar/SidebarListItem.vue +11 -0
  17. package/components/layout/Sidebar/SidebarTitle.vue +42 -0
  18. package/components/layout/Topbar/Topbar.vue +11 -10
  19. package/defaults/vuetify.js +7 -6
  20. package/package.json +2 -2
  21. package/static/{favicon.ico → mapo/favicon.ico} +0 -0
  22. package/static/mapo/tinymce-skins/mapo-dark/content.inline.min.css +7 -0
  23. package/static/mapo/tinymce-skins/mapo-dark/content.min.css +7 -0
  24. package/static/mapo/tinymce-skins/mapo-dark/content.mobile.min.css +7 -0
  25. package/static/mapo/tinymce-skins/mapo-dark/skin.min.css +7 -0
  26. package/static/mapo/tinymce-skins/mapo-dark/skin.mobile.min.css +7 -0
  27. package/static/mapo/tinymce-skins/mapo-light/content.inline.min.css +7 -0
  28. package/static/mapo/tinymce-skins/mapo-light/content.min.css +7 -0
  29. package/static/mapo/tinymce-skins/mapo-light/content.mobile.min.css +7 -0
  30. package/static/mapo/tinymce-skins/mapo-light/skin.min.css +7 -0
  31. package/static/mapo/tinymce-skins/mapo-light/skin.mobile.min.css +7 -0
  32. package/components/layout/Sidebar/SidebarFooter.vue +0 -52
package/CHANGELOG.md CHANGED
@@ -3,6 +3,39 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [1.0.0-alpha.38](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.37...v1.0.0-alpha.38) (2022-11-22)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * append color icon in color field ([7d17806](https://github.com/lotrekagency/mapo/commit/7d178067ccea0304df744c53f0b6142a54667f51))
12
+ * clear tinymce content on startup ([e8e3599](https://github.com/lotrekagency/mapo/commit/e8e35998fd56cb832493a7a2d54c941e8ecc2fe2))
13
+ * fix layout shift of media field after media selection ([b59e0f2](https://github.com/lotrekagency/mapo/commit/b59e0f26fee3b0b670d787dcb0b423690d389885))
14
+ * fix static resources base path ([ed8351d](https://github.com/lotrekagency/mapo/commit/ed8351d55f3c1cfee435faec4ebc684bb92a1e78))
15
+ * fix tinymce skin mapo-light menu hover color ([c176df8](https://github.com/lotrekagency/mapo/commit/c176df88616a8554231cd8f660d63a064595be3e))
16
+ * remove settings link ([d4be262](https://github.com/lotrekagency/mapo/commit/d4be262deb0c55fccda8de60adb7111a6136beed))
17
+
18
+
19
+ ### Features
20
+
21
+ * added error state for wyg editor based on mapo field error state ([c1f2dbd](https://github.com/lotrekagency/mapo/commit/c1f2dbd2e2ed7308396a3497cfbe44cd072d6ee4))
22
+ * added error state to mapofield and reduced div nesting ([751ffeb](https://github.com/lotrekagency/mapo/commit/751ffeb40572d4755a467cacbbd9731d761651b7))
23
+ * added slots for sidebar and topbar ([7ac86e7](https://github.com/lotrekagency/mapo/commit/7ac86e7d71347bb0b57b7a175a887afa4c0030d7))
24
+ * auto hideDetails on fields without error messages ([7654bf3](https://github.com/lotrekagency/mapo/commit/7654bf3854224596587bdeb461c3dd1d11a6e1a3))
25
+ * tinymce better theming ([c1c5c88](https://github.com/lotrekagency/mapo/commit/c1c5c88d9e1b46dcc008491d55bb52ee4e7296e4))
26
+ * tinymce enhancements and theming ([5bb1168](https://github.com/lotrekagency/mapo/commit/5bb1168bcad8dcfc735a0ccf10f891a827520391))
27
+ * update style of form groups ([a4d9238](https://github.com/lotrekagency/mapo/commit/a4d9238625a19ba16ecf692069515c986ffcf615))
28
+ * update vuetify color scheme ([18aff8d](https://github.com/lotrekagency/mapo/commit/18aff8dc0de8c868e62f26df048a12dd97ef2f2b))
29
+
30
+
31
+ ### Performance Improvements
32
+
33
+ * decrease div nesting in forms ([537a59c](https://github.com/lotrekagency/mapo/commit/537a59c884dce7ae4d959724349956246c1fd680))
34
+
35
+
36
+
37
+
38
+
6
39
  # [1.0.0-alpha.37](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.36...v1.0.0-alpha.37) (2022-11-14)
7
40
 
8
41
 
@@ -31,7 +31,7 @@
31
31
  <DetailLangSwitch
32
32
  v-if="langs && langs.length"
33
33
  v-show="langs.length > 1"
34
- class="mb-4"
34
+ class="mb-4 language-tabs"
35
35
  v-model="currentLang"
36
36
  :langs="langs"
37
37
  :errors="errors"
@@ -8,6 +8,11 @@
8
8
  </v-tabs>
9
9
  </template>
10
10
 
11
+ <style lang="scss">
12
+ .theme--light.language-tabs.v-tabs > .v-tabs-bar {
13
+ background: #f5f5f5;
14
+ }
15
+ </style>
11
16
  <script>
12
17
  import { getPointed } from "@mapomodule/utils/helpers/objHelpers";
13
18
  /**
@@ -49,7 +49,7 @@
49
49
  </template>
50
50
  </FormGroup>
51
51
 
52
- <div v-else>
52
+ <template v-else>
53
53
  <slot :name="field.slotName + '.before'" v-bind="{ conf: field, ...slotBindings, }" />
54
54
  <slot
55
55
  :name="field.slotName"
@@ -76,7 +76,7 @@
76
76
  </FormField>
77
77
  </slot>
78
78
  <slot :name="field.slotName + '.after'" v-bind="{ conf: field, ...slotBindings, }" />
79
- </div>
79
+ </template>
80
80
  </div>
81
81
  </div>
82
82
  </template>
@@ -1,25 +1,22 @@
1
1
  <template>
2
- <div>
3
- <span class="mapo-label" :class="`mapo-label-${conf.value}`">{{label}}</span>
4
- <component :is="is" v-model="model" v-bind="fieldAttrs">
5
- <template v-for="(_, slot) in $slots" :slot="slot">
6
- <!-- @vuese-ignore -->
7
- <slot :name="slot"></slot>
8
- </template>
9
- <template v-for="(_, slot) in $scopedSlots" v-slot:[slot]="props">
10
- <!-- @vuese-ignore -->
11
- <slot :name="slot" v-bind="props" />
12
- </template>
13
- </component>
14
- </div>
2
+ <component
3
+ class="mapo-field"
4
+ :class="classes"
5
+ :is="is"
6
+ v-model="model"
7
+ v-bind="fieldAttrs"
8
+ >
9
+ <template v-for="(_, slot) in $slots" :slot="slot">
10
+ <!-- @vuese-ignore -->
11
+ <slot :name="slot"></slot>
12
+ </template>
13
+ <template v-for="(_, slot) in $scopedSlots" v-slot:[slot]="props">
14
+ <!-- @vuese-ignore -->
15
+ <slot :name="slot" v-bind="props" />
16
+ </template>
17
+ </component>
15
18
  </template>
16
19
 
17
- <style>
18
- .mapo-label {
19
- display: none;
20
- }
21
- </style>
22
-
23
20
  <script>
24
21
  import wygEditor from "@mapomodule/uikit/components/Form/fields/wygEditor/wygEditor.vue";
25
22
  import DateField from "@mapomodule/uikit/components/Form/fields/DateField.vue";
@@ -30,7 +27,7 @@ import EnhancedMediaField from "@mapomodule/uikit/components/Form/fields/Enhance
30
27
 
31
28
  import SeoPreview from "@mapomodule/uikit/components/Form/fields/SeoPreview.vue";
32
29
  import FileField from "@mapomodule/uikit/components/Form/fields/FileField.vue";
33
- import Repeater from "@mapomodule/uikit/components/Form/fields/Repeater.vue"
30
+ import Repeater from "@mapomodule/uikit/components/Form/fields/Repeater.vue";
34
31
 
35
32
  import { getPointed, setPointed } from "@mapomodule/utils/helpers/objHelpers";
36
33
  import { titleCase } from "@mapomodule/utils/helpers/formatters";
@@ -81,9 +78,9 @@ export default {
81
78
  },
82
79
  langs: {
83
80
  type: Array,
84
- default: () => []
81
+ default: () => [],
85
82
  },
86
- currentLang: String
83
+ currentLang: String,
87
84
  },
88
85
  watch: {
89
86
  value: {
@@ -107,42 +104,54 @@ export default {
107
104
  debouncedSetValue: debounce(function (...args) {
108
105
  this.setValue(...args);
109
106
  }, 300),
110
- setValue(val){
107
+ setValue(val) {
111
108
  const dump = { ...this.value }; // since we cannot directly edit a prop
112
- setPointed(
113
- dump,
114
- this.kpointed,
115
- this.accessor.set({ model: dump, val })
116
- );
117
- if (typeof this.conf.onChange == "function")
109
+ setPointed(dump, this.kpointed, this.accessor.set({ model: dump, val }));
110
+ if (typeof this.conf.onChange == "function")
118
111
  this.conf.onChange({
119
112
  val,
120
113
  model: dump,
121
114
  currentLang: this.currentLang,
122
115
  languages: this.langs,
123
116
  conf: this.conf,
124
- kpointed: this.kpointed
125
- })
117
+ kpointed: this.kpointed,
118
+ });
126
119
 
127
120
  // Fired when the v-model changes.
128
121
  // @arg Emits the entire payload modified.
129
122
  this.$emit("input", dump);
130
123
  },
131
- extractValue(val = this.value){
124
+ extractValue(val = this.value) {
132
125
  return this.accessor.get({
133
126
  model: { ...val },
134
127
  val: getPointed({ ...val }, this.kpointed),
135
128
  });
136
129
  },
137
130
  setModel(val = this.value) {
138
- var model = this.extractValue(val)
131
+ var model = this.extractValue(val);
139
132
  if (val && JSON.stringify(this.model) !== JSON.stringify(model))
140
133
  this.model = model;
141
134
  },
142
135
  },
143
136
  computed: {
144
- kpointed(){
145
- let kpointed = this.conf.value
137
+ classes() {
138
+ var upperClasses = this.fieldAttrs.class;
139
+ if (typeof upperClasses == "string") {
140
+ upperClasses = { [upperClasses]: true };
141
+ } else if (Array.isArray(upperClasses)) {
142
+ upperClasses = upperClasses.reduce(
143
+ (acc, next) => ({ ...acc, [next]: true }),
144
+ {}
145
+ );
146
+ }
147
+ return {
148
+ ...upperClasses,
149
+ [`mapo-field-${this.conf.value}`]: true,
150
+ "mapo-field--has-errors": this.hasErrors,
151
+ };
152
+ },
153
+ kpointed() {
154
+ let kpointed = this.conf.value;
146
155
  if (this.currentLang && !this.conf.synci18n) {
147
156
  const base = `translations.${this.currentLang}`;
148
157
  kpointed = kpointed ? `${base}.${kpointed}` : base;
@@ -160,21 +169,28 @@ export default {
160
169
  ...this.conf.accessor,
161
170
  };
162
171
  },
172
+ errorMessages() {
173
+ return this.kpointed
174
+ .split(".")
175
+ .map((_, i, a) => a.slice(0, i + 1).join("."))
176
+ .reduce((acc, next) => {
177
+ const error = getPointed(this.errors || {}, next, []);
178
+ if (Array.isArray(error)) {
179
+ acc = [...acc, ...error];
180
+ } else if (typeof error == "string") {
181
+ acc = [...acc, error];
182
+ }
183
+ return acc;
184
+ }, []);
185
+ },
186
+ hasErrors() {
187
+ return !!this.errorMessages.length;
188
+ },
163
189
  fieldAttrs() {
164
190
  return {
165
191
  label: this.label,
166
- errorMessages: this.kpointed
167
- .split(".")
168
- .map((_, i, a) => a.slice(0, i + 1).join("."))
169
- .reduce((acc, next) => {
170
- const error = getPointed(this.errors || {}, next, []);
171
- if (Array.isArray(error)) {
172
- acc = [...acc, ...error];
173
- } else if (typeof error == "string") {
174
- acc = [...acc, error];
175
- }
176
- return acc;
177
- }, []),
192
+ errorMessages: this.errorMessages,
193
+ hideDetails: this.hasErrors,
178
194
  ...this.defaultAttrs.All,
179
195
  ...(this.defaultAttrs[
180
196
  this.is.replace(/-./g, (x) => x[1].toUpperCase())
@@ -205,8 +221,8 @@ export default {
205
221
  );
206
222
  },
207
223
  },
208
- mounted(){
209
- this.setModel()
210
- }
224
+ mounted() {
225
+ this.setModel();
226
+ },
211
227
  };
212
- </script>
228
+ </script>
@@ -1,14 +1,17 @@
1
1
  <template>
2
2
  <v-card v-if="conf" v-show="show(conf.group)" class="my-2 rounded-0 elevation-0 group-card">
3
- <v-card-title :class="conf.group.titleClass">
3
+ <v-card-title class="text--secondary" :class="conf.group.titleClass">
4
4
  <slot name="title.before" v-bind="slotBindings" />
5
5
  <slot name="title" v-bind="slotBindings">
6
6
  <v-icon left> {{ conf.group.icon }} </v-icon>
7
7
  <span>{{ conf.group.name }}</span>
8
8
  </slot>
9
9
  <slot name="title.after" v-bind="slotBindings" />
10
+ <slot name="expandIcon" v-bind="slotBindings">
11
+ <v-icon class="expand-icon" :style="rotate" @click="expanded = !expanded"> mdi-chevron-up </v-icon>
12
+ </slot>
10
13
  </v-card-title>
11
- <div class="container">
14
+ <div v-if="expanded" class="container">
12
15
  <Form
13
16
  v-model="model"
14
17
  v-bind="{ currentLang, errors, languages, readonly }"
@@ -29,9 +32,29 @@
29
32
  </v-card>
30
33
  </template>
31
34
  <style lang="scss" scoped>
35
+ .expand-icon{
36
+ margin: 0 0 0 auto;
37
+ }
32
38
  .theme--light .group-card {
33
39
  border: 1px solid rgba(0, 0, 0, 0.12);
34
40
  }
41
+ .group-card .v-card__title{
42
+ padding: 6px 16px;
43
+ background: #0000002b;
44
+ position: relative;
45
+ &::after{
46
+ content: '';
47
+ position: absolute;
48
+ background: var(--v-primary-base);
49
+ height: 100%;
50
+ width: 4px;
51
+ left: 0;
52
+ }
53
+ }
54
+ .theme--light .v-card__title{
55
+ background: #ffffff;
56
+ border-bottom: 1px solid rgba(0, 0, 0, 0.12);
57
+ }
35
58
  </style>
36
59
  <script>
37
60
  export default {
@@ -39,6 +62,7 @@ export default {
39
62
  data() {
40
63
  return {
41
64
  model: {},
65
+ expanded: true
42
66
  };
43
67
  },
44
68
  props: {
@@ -88,6 +112,12 @@ export default {
88
112
  ...this.moreSlotBindings,
89
113
  };
90
114
  },
115
+ rotate() {
116
+ return {
117
+ transform: this.expanded ? "rotate(180deg)" : "rotate(0deg)",
118
+ transition: "transform 225ms cubic-bezier(0.4, 0, 0.2, 1)",
119
+ };
120
+ },
91
121
  },
92
122
  methods: {
93
123
  show(conf, type = "display"){
@@ -7,8 +7,11 @@
7
7
  <span>{{ conf.group.name }}</span>
8
8
  </slot>
9
9
  <slot name="title.after" v-bind="slotBindings" />
10
+ <slot name="expandIcon" v-bind="slotBindings">
11
+ <v-icon class="expand-icon" :style="rotate" @click="expanded = !expanded"> mdi-chevron-up </v-icon>
12
+ </slot>
10
13
  </v-card-title>
11
- <div class="container">
14
+ <div v-if="expanded" class="container">
12
15
  <v-tabs v-model="tabIndex" class="tab-wrapper">
13
16
  <v-tab v-for="(tab, index) in conf.tabs" :key="index" v-show="show(tab)">
14
17
  <v-badge :value="hasErrors(tab)" color="error" dot>
@@ -50,12 +53,33 @@
50
53
  </template>
51
54
 
52
55
  <style lang="scss" scoped>
56
+ .expand-icon{
57
+ margin: 0 0 0 auto;
58
+ }
53
59
  .tab-wrapper {
54
60
  margin: -12px 0 0 -12px;
55
61
  }
56
62
  .theme--light .tabs-card {
57
63
  border: 1px solid rgba(0, 0, 0, 0.12);
58
64
  }
65
+ .tabs-card .v-card__title{
66
+ padding: 6px 16px;
67
+ background: #0000002b;
68
+ position: relative;
69
+ &::after{
70
+ content: '';
71
+ position: absolute;
72
+ background: var(--v-primary-base);
73
+ height: 100%;
74
+ width: 4px;
75
+ left: 0;
76
+ }
77
+ }
78
+ .theme--light .v-card__title{
79
+ background: #ffffff;
80
+ border-bottom: 1px solid rgba(0, 0, 0, 0.12);
81
+ }
82
+
59
83
  </style>
60
84
  <script>
61
85
  import { findPropPaths } from "@mapomodule/utils/helpers/objHelpers";
@@ -67,6 +91,7 @@ export default {
67
91
  return {
68
92
  model: {},
69
93
  tabIndex: 0,
94
+ expanded: true,
70
95
  };
71
96
  },
72
97
  props: {
@@ -125,6 +150,12 @@ export default {
125
150
  this.conf.group.icon
126
151
  );
127
152
  },
153
+ rotate() {
154
+ return {
155
+ transform: this.expanded ? "rotate(180deg)" : "rotate(0deg)",
156
+ transition: "transform 225ms cubic-bezier(0.4, 0, 0.2, 1)",
157
+ };
158
+ },
128
159
  },
129
160
  methods: {
130
161
  nameSpacedSlots,
@@ -15,7 +15,7 @@
15
15
  v-on="readonly ? undefined : on"
16
16
  class="rounded-0"
17
17
  >
18
- <template v-slot:prepend-inner>
18
+ <template v-if="model" v-slot:append>
19
19
  <div class="color-picker-inner-icon" :style="`background-color: ${model}`"></div>
20
20
  </template>
21
21
  </v-text-field>
@@ -56,7 +56,7 @@
56
56
  .media-field--selected {
57
57
  .v-text-field__slot {
58
58
  position: absolute !important;
59
- width: 100%;
59
+ width: calc(100% - 24px);
60
60
  height: 100%;
61
61
  }
62
62
  .v-input__append-inner {
@@ -1,57 +1,25 @@
1
- var useDarkMode = false;
2
-
3
- export default {
4
- plugins: 'mapomedia preview paste importcss searchreplace autolink directionality code visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor insertdatetime advlist lists wordcount textpattern noneditable help charmap quickbars emoticons',
5
- // imagetools_cors_hosts: ['picsum.photos'],
6
- menubar: 'file edit view insert format tools table help',
7
- menu: { insert: { title: 'Insert', items: 'link mapomedia media template codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor | insertdatetime' } },
8
- toolbar: 'undo redo | bold italic underline strikethrough | fontselect fontsizeselect formatselect | alignleft aligncenter alignright alignjustify | outdent indent | numlist bullist | forecolor backcolor removeformat | pagebreak | charmap emoticons | fullscreen preview | mapomedia media template link anchor codesample | ltr rtl',
1
+ export default ({ isDark, base }) => ({
2
+ plugins: "mapomedia preview paste importcss searchreplace autolink directionality code visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor insertdatetime advlist lists wordcount textpattern noneditable help charmap quickbars emoticons",
3
+ menubar: "file edit view insert format tools table help",
4
+ menu: {
5
+ insert: {
6
+ title: "Insert",
7
+ items: "link mapomedia media template codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor | insertdatetime",
8
+ },
9
+ },
10
+ toolbar: "undo redo | bold italic underline strikethrough | fontselect fontsizeselect formatselect | alignleft aligncenter alignright alignjustify | outdent indent | numlist bullist | forecolor backcolor removeformat | pagebreak | charmap emoticons | fullscreen preview | mapomedia media template link anchor codesample | ltr rtl",
9
11
  toolbar_sticky: true,
10
12
  image_advtab: true,
11
- // link_list: [
12
- // { title: 'My page 1', value: 'https://www.tiny.cloud' },
13
- // { title: 'My page 2', value: 'http://www.moxiecode.com' }
14
- // ],
15
- // image_list: [
16
- // { title: 'My page 1', value: 'https://www.tiny.cloud' },
17
- // { title: 'My page 2', value: 'http://www.moxiecode.com' }
18
- // ],
19
- // image_class_list: [
20
- // { title: 'None', value: '' },
21
- // { title: 'Some class', value: 'class-name' }
22
- // ],
23
13
  importcss_append: true,
24
- // file_picker_callback: function (callback, value, meta) {
25
- // /* Provide file and text for the link dialog */
26
- // if (meta.filetype === 'file') {
27
- // callback('https://www.google.com/logos/google.jpg', { text: 'My text' });
28
- // }
29
-
30
- // /* Provide image and alt text for the image dialog */
31
- // if (meta.filetype === 'image') {
32
- // callback('https://www.google.com/logos/google.jpg', { alt: 'My alt text' });
33
- // }
34
-
35
- // /* Provide alternative source and posted for the media dialog */
36
- // if (meta.filetype === 'media') {
37
- // callback('movie.mp4', { source2: 'alt.ogg', poster: 'https://www.google.com/logos/google.jpg' });
38
- // }
39
- // },
40
- // templates: [
41
- // { title: 'New Table', description: 'creates a new table', content: '<div class="mceTmpl"><table width="98%%" border="0" cellspacing="0" cellpadding="0"><tr><th scope="col"> </th><th scope="col"> </th></tr><tr><td> </td><td> </td></tr></table></div>' },
42
- // { title: 'Starting my story', description: 'A cure for writers block', content: 'Once upon a time...' },
43
- // { title: 'New list with dates', description: 'New List with dates', content: '<div class="mceTmpl"><span class="cdate">cdate</span><br /><span class="mdate">mdate</span><h2>My List</h2><ul><li></li><li></li></ul></div>' }
44
- // ],
45
- template_cdate_format: '[Date Created (CDATE): %m/%d/%Y : %H:%M:%S]',
46
- template_mdate_format: '[Date Modified (MDATE): %m/%d/%Y : %H:%M:%S]',
14
+ template_cdate_format: "[Date Created (CDATE): %m/%d/%Y : %H:%M:%S]",
15
+ template_mdate_format: "[Date Modified (MDATE): %m/%d/%Y : %H:%M:%S]",
47
16
  height: 400,
48
17
  image_caption: true,
49
- quickbars_insert_toolbar: 'mapomedia quicktable',
50
- quickbars_selection_toolbar: 'bold italic | quicklink h2 h3 blockquote mapomedia quicktable',
51
- noneditable_noneditable_class: 'mceNonEditable',
52
- toolbar_mode: 'sliding',
53
- contextmenu: 'link mapomedia table',
54
- skin: useDarkMode ? 'oxide-dark' : 'oxide',
55
- content_css: useDarkMode ? 'dark' : 'default',
56
- content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:14px }'
57
- }
18
+ quickbars_insert_toolbar: "mapomedia quicktable",
19
+ quickbars_selection_toolbar: "bold italic | quicklink h2 h3 blockquote mapomedia quicktable",
20
+ noneditable_noneditable_class: "mceNonEditable",
21
+ toolbar_mode: "sliding",
22
+ contextmenu: "link mapomedia table",
23
+ skin_url: isDark ? `${base}mapo/tinymce-skins/mapo-dark` : `${base}mapo/tinymce-skins/mapo-light`,
24
+ content_style: "body { font-family:Helvetica,Arial,sans-serif; font-size:14px }",
25
+ });
@@ -1,7 +1,7 @@
1
1
  <template>
2
- <div>
2
+ <div class="mapo-wyg-editor">
3
3
  <media-manager-dialog ref="mediaManager"></media-manager-dialog>
4
- <span v-if="label" class="v-label" :class="{'error--text': errorMessages && errorMessages.length}">{{ label }}:</span>
4
+ <span v-if="label" class="v-label" :class="{'error--text': hasErrors, 'text--secondary': !hasErrors}">{{ label }}:</span>
5
5
  <div ref="editorNode">
6
6
  <v-skeleton-loader
7
7
  type="table-heading, list-item-two-line, list-item-avatar-two-line, list-item-three-lineimage, table-tfoot"
@@ -13,6 +13,24 @@
13
13
  </div>
14
14
  </template>
15
15
 
16
+ <style lang="scss">
17
+ .tox-notifications-container,
18
+ .tox-statusbar__branding {
19
+ display: none;
20
+ }
21
+ .v-label.error--text{
22
+ animation: v-shake 0.6s cubic-bezier(0.25, 0.8, 0.5, 1);
23
+ }
24
+ .tox-tinymce-aux {
25
+ z-index: 200 !important;
26
+ }
27
+ .mapo-field--has-errors{
28
+ .tox.tox-tinymce{
29
+ border: solid var(--v-error-base) 2px;
30
+ }
31
+ }
32
+ </style>
33
+
16
34
  <script>
17
35
  import initMapoMedia from "./utils/mapomedia.plugin.js";
18
36
  import injectScript from "./utils/script.injector.js";
@@ -60,12 +78,18 @@ export default {
60
78
  },
61
79
 
62
80
  computed: {
81
+ hasErrors () { return this.errorMessages && this.errorMessages.length },
63
82
  editor: {
64
83
  cache: false,
65
84
  get() {
66
85
  return this.editorInstance;
67
86
  },
68
87
  },
88
+ defaultConfiguration(){
89
+ const { base } = this.$router.options;
90
+ const { isDark } = this.$vuetify.theme;
91
+ return defaults({ base, isDark })
92
+ }
69
93
  },
70
94
 
71
95
  mounted() {
@@ -76,18 +100,23 @@ export default {
76
100
  initEditor() {
77
101
  initMapoMedia(this.insertMediaCallback);
78
102
  window.tinymce.init(
79
- Object.assign(defaults, this.conf, {
103
+ Object.assign(this.defaultConfiguration, this.conf, {
80
104
  target: this.$refs.editorNode,
81
105
  readonly: this.readonly,
82
106
  setup: (ctx) => this.setupEditor(ctx),
83
107
  })
84
108
  );
109
+ window.document.addEventListener('click', this.closeModal);
85
110
  },
86
111
  setupEditor(editor) {
87
112
  this.editorInstance = editor;
88
113
  editor.on("init", () => {
89
- editor.setContent(this.value || "");
90
- this.emitContent(editor);
114
+ if (this.value){
115
+ editor.setContent(this.value);
116
+ this.emitContent(editor);
117
+ } else {
118
+ editor.setContent("");
119
+ }
91
120
  editor.on("change input undo redo keyup", () =>
92
121
  this.emitContent(editor)
93
122
  );
@@ -108,6 +137,10 @@ export default {
108
137
  });
109
138
  }
110
139
  },
140
+ closeModal(event){
141
+ if (event.target.classList.contains("tox-dialog-wrap__backdrop"))
142
+ this.editor.windowManager.close();
143
+ },
111
144
  insertMediaCallback: async function () {
112
145
  return new Promise((resolve, reject) => {
113
146
  this.$refs.mediaManager.open()
@@ -136,9 +169,17 @@ export default {
136
169
  .catch((error) => reject(error));
137
170
  });
138
171
  },
172
+ destroyEditor(){
173
+ window?.document?.removeEventListener('click', this.closeModal);
174
+ window?.tinymce?.remove(this.editor);
175
+ },
176
+ reloadEditor(){
177
+ this.destroyEditor();
178
+ this.initEditor();
179
+ }
139
180
  },
140
181
  beforeDestroy() {
141
- window && window.tinymce && window.tinymce.remove(this.editor);
182
+ this.destroyEditor();
142
183
  },
143
184
  watch: {
144
185
  value(val) {
@@ -152,23 +193,11 @@ export default {
152
193
  this.editor.setMode(val ? "readonly" : "design");
153
194
  }
154
195
  },
196
+ '$vuetify.theme.isDark'(){ this.reloadEditor(); }
155
197
  },
156
198
  };
157
199
  </script>
158
200
 
159
- <style>
160
- .tox-notifications-container,
161
- .tox-statusbar__branding {
162
- display: none;
163
- }
164
- .v-label.error--text{
165
- animation: v-shake 0.6s cubic-bezier(0.25, 0.8, 0.5, 1);
166
- }
167
- .tox-tinymce-aux {
168
- z-index: 200 !important;
169
- }
170
- </style>
171
-
172
201
  <docs>
173
202
 
174
203
  ### Defaults
@@ -38,7 +38,8 @@
38
38
  import { mapGetters, mapActions } from "vuex";
39
39
 
40
40
  export default {
41
- computed: mapGetters("mapo/media", ["parentFolders"]),
42
- methods: mapActions("mapo/media", ["getRoot"]),
41
+ name: "MediaBreadcrumbs",
42
+ computed: {...mapGetters("mapo/media", ["parentFolders"])},
43
+ methods: {...mapActions("mapo/media", ["getRoot"])},
43
44
  };
44
45
  </script>