@mapomodule/uikit 1.0.0-alpha.2 → 1.0.0-alpha.20

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 (49) hide show
  1. package/CHANGELOG.md +370 -0
  2. package/components/Detail/Detail.vue +281 -126
  3. package/components/Detail/DetailField.vue +68 -29
  4. package/components/Detail/DetailLangSwitch.vue +1 -1
  5. package/components/Detail/defaults.js +33 -25
  6. package/components/DropArea.vue +3 -3
  7. package/components/List/List.vue +120 -42
  8. package/components/List/ListActions.vue +56 -17
  9. package/components/List/ListFilters.vue +158 -113
  10. package/components/List/ListHead.vue +30 -12
  11. package/components/List/ListQuickEdit.vue +207 -55
  12. package/components/List/ListTable.vue +292 -77
  13. package/components/Login.vue +14 -5
  14. package/components/MediaManager/MediaEditor.vue +253 -107
  15. package/components/MediaManager/MediaFolders.vue +134 -43
  16. package/components/MediaManager/MediaGallery.vue +56 -52
  17. package/components/MediaManager/MediaManager.vue +127 -83
  18. package/components/MediaManager/MediaManagerDialog.vue +19 -22
  19. package/components/MediaManager/MediaPreview.vue +180 -0
  20. package/components/MediaManager/MediaUploader.vue +35 -32
  21. package/components/SnackBar.vue +3 -4
  22. package/components/ThemeToggle.vue +13 -0
  23. package/components/fields/DateField.vue +9 -3
  24. package/components/fields/FileField.vue +125 -0
  25. package/components/fields/FksField.vue +88 -0
  26. package/components/fields/MediaField.vue +36 -6
  27. package/components/fields/MediaM2mField.vue +8 -3
  28. package/components/fields/Repeater.vue +338 -0
  29. package/components/fields/SeoPreview.vue +89 -0
  30. package/components/fields/{TinyMce → wygEditor}/defaults.js +7 -5
  31. package/components/fields/{TinyMce → wygEditor}/utils/events.js +0 -0
  32. package/components/fields/{TinyMce → wygEditor}/utils/mapomedia.plugin.js +7 -6
  33. package/components/fields/{TinyMce → wygEditor}/utils/script.injector.js +0 -0
  34. package/components/fields/wygEditor/wygEditor.vue +256 -0
  35. package/components/layout/Sidebar/Sidebar.vue +35 -32
  36. package/components/layout/Sidebar/SidebarFooter.vue +42 -46
  37. package/components/layout/Sidebar/SidebarList.vue +13 -14
  38. package/components/layout/Sidebar/SidebarListItem.vue +99 -38
  39. package/components/layout/Sidebar/SidebarProfile.vue +42 -0
  40. package/components/layout/Topbar/Topbar.vue +3 -35
  41. package/components/layout/routebuilder.js +3 -3
  42. package/defaults.js +2 -2
  43. package/layouts/default.vue +20 -18
  44. package/layouts/empty.vue +10 -0
  45. package/package.json +5 -4
  46. package/pages/index.vue +1 -2
  47. package/components/fields/M2mField.vue +0 -95
  48. package/components/fields/TinyMce/TinyMce.vue +0 -177
  49. package/layouts/error.vue +0 -45
@@ -12,8 +12,10 @@
12
12
  <div style="position: relative">
13
13
  <v-img
14
14
  v-if="mediaExists"
15
- :src="internalValue.file"
16
- :lazy-src="internalValue.thumbnail"
15
+ :src="internalValue.is_image && internalValue.file || null"
16
+ :lazy-src="internalValue.is_image && internalValue.thumbnail || null"
17
+
18
+ :class="{'grey lighten-2': !internalValue.is_image}"
17
19
  v-bind="{
18
20
  aspectRatio,
19
21
  contain,
@@ -33,9 +35,15 @@
33
35
  justify="center"
34
36
  >
35
37
  <v-progress-circular
38
+ v-if="internalValue.is_image"
36
39
  indeterminate
37
40
  color="grey"
38
41
  ></v-progress-circular>
42
+ <div class="d-flex flex-column align-center justify-space-between fill-height" style="width: 100%" v-else>
43
+ <div></div>
44
+ <v-icon size="70px" color="grey">mdi-file</v-icon>
45
+ <span class="grey--text text--darken-3 text-truncate pl-1 pr-8" style="width: 100%">{{fileName}}</span>
46
+ </div>
39
47
  </v-row>
40
48
  </template>
41
49
  </v-img>
@@ -43,6 +51,7 @@
43
51
  <!-- If the media is not avaible, it shows a btn to add new media -->
44
52
  <v-card
45
53
  v-else-if="!rmAddBtn"
54
+ class="rounded-0"
46
55
  v-bind="{
47
56
  height,
48
57
  width,
@@ -56,7 +65,7 @@
56
65
  <v-card-title>{{ label }}</v-card-title>
57
66
 
58
67
  <v-card-actions>
59
- <v-btn @click="editing = true" block :min-height="minHeight">
68
+ <v-btn tile :disabled="readonly" @click="editing = true" block :min-height="minHeight">
60
69
  <v-icon size="80"> mdi-plus-circle-outline </v-icon>
61
70
  </v-btn>
62
71
  </v-card-actions>
@@ -71,13 +80,13 @@
71
80
  </v-row>
72
81
  <v-row>
73
82
  <v-col cols="6">
74
- <v-btn @click="editing = true" fab v-bind="$attrs">
83
+ <v-btn :disabled="readonly" @click="editing = true" fab v-bind="$attrs">
75
84
  <v-icon>mdi-pencil</v-icon>
76
85
  </v-btn>
77
86
  </v-col>
78
87
 
79
88
  <v-col cols="6">
80
- <v-btn @click="confirmDelete" fab v-bind="$attrs">
89
+ <v-btn :disabled="readonly" @click="confirmDelete" fab v-bind="$attrs">
81
90
  <v-icon>mdi-delete</v-icon>
82
91
  </v-btn>
83
92
  </v-col>
@@ -95,6 +104,11 @@
95
104
 
96
105
  </div>
97
106
  </v-hover>
107
+ <v-messages
108
+ v-model="errorMessages"
109
+ color="error"
110
+ class="mt-2"
111
+ />
98
112
  </div>
99
113
  </template>
100
114
 
@@ -119,6 +133,10 @@ export default {
119
133
  type: String,
120
134
  default: () => "",
121
135
  },
136
+ errorMessages: {
137
+ type: String | Array,
138
+ default: () => []
139
+ },
122
140
  rmAddBtn: {
123
141
  type: Boolean,
124
142
  default: false,
@@ -156,6 +174,11 @@ export default {
156
174
  type: String | Number,
157
175
  default: 300,
158
176
  },
177
+ // This set the component status to readonly, stopping the user interaction.
178
+ readonly: {
179
+ type: Boolean,
180
+ default: false,
181
+ },
159
182
  },
160
183
 
161
184
  computed: {
@@ -165,6 +188,9 @@ export default {
165
188
  overlay() {
166
189
  return this.isHovered && this.mediaExists;
167
190
  },
191
+ fileName() {
192
+ return this.internalValue && this.internalValue.file && this.internalValue.file.split("/").pop();
193
+ },
168
194
  },
169
195
 
170
196
  methods: {
@@ -175,7 +201,8 @@ export default {
175
201
  this.$mapo.$confirm
176
202
  .open({
177
203
  title: "Remove",
178
- question: "Are you sure to want to remove this media?"
204
+ question: "Are you sure to want to remove this media?",
205
+ approveButton: { text: "Remove", attrs: { color: "red", text: true } }
179
206
  })
180
207
  .then((res) => (res ? (this.internalValue = null) : null));
181
208
  },
@@ -191,5 +218,8 @@ export default {
191
218
  this.$emit("input", val);
192
219
  },
193
220
  },
221
+ mounted(){
222
+ this.internalValue = this.val
223
+ }
194
224
  };
195
225
  </script>
@@ -62,7 +62,7 @@
62
62
 
63
63
  <v-card-actions class="paginator mt-auto" v-if="pages">
64
64
  <v-row justify="center" class="py-2">
65
- <v-btn text @click="prev">
65
+ <v-btn :disabled="readonly" text @click="prev">
66
66
  <v-icon>mdi-chevron-left</v-icon>
67
67
  </v-btn>
68
68
  <v-item-group v-model="page" class="text-center mx-1" mandatory>
@@ -71,12 +71,12 @@
71
71
  :key="`btn-${n}`"
72
72
  v-slot="{ active, toggle }"
73
73
  >
74
- <v-btn :input-value="active" icon @click="toggle">
74
+ <v-btn :disabled="readonly" :input-value="active" icon @click="toggle">
75
75
  <v-icon>mdi-record</v-icon>
76
76
  </v-btn>
77
77
  </v-item>
78
78
  </v-item-group>
79
- <v-btn text @click="next">
79
+ <v-btn :disabled="readonly" text @click="next">
80
80
  <v-icon>mdi-chevron-right</v-icon>
81
81
  </v-btn>
82
82
  </v-row>
@@ -173,6 +173,11 @@ export default {
173
173
  type: Boolean,
174
174
  default: false,
175
175
  },
176
+ // This set the component status to readonly, stopping the user interaction.
177
+ readonly: {
178
+ type: Boolean,
179
+ default: false,
180
+ },
176
181
  },
177
182
 
178
183
  model: {
@@ -0,0 +1,338 @@
1
+ <template>
2
+ <div class="container pa-0">
3
+ <span class="repeater-label">{{ label }}:</span>
4
+ <v-divider />
5
+ <draggable
6
+ v-model="items"
7
+ handle=".repeater-handle-sort"
8
+ animation="150"
9
+ @change="sortCallback({ ...$event, items, eventType: 'move' })"
10
+ >
11
+ <div
12
+ class="repeater-wrapper"
13
+ v-for="(model, index) in items"
14
+ :key="index"
15
+ >
16
+ <div class="d-flex">
17
+ <v-divider vertical />
18
+ <div class="row ma-0">
19
+ <div
20
+ v-for="(field, i) in parseFields(model)"
21
+ :key="i"
22
+ :class="field.class || 'col-12'"
23
+ >
24
+ <DetailField
25
+ v-model="items[index]"
26
+ :conf="field"
27
+ :errors="getErrors(index)"
28
+ />
29
+ </div>
30
+ </div>
31
+ <div class="repeater-side-bar grey lighten-2">
32
+ <span
33
+ class="repeater-counter grey--text text--darken-2 text-truncate"
34
+ >{{ index + 1 }}</span
35
+ >
36
+ <v-tooltip right>
37
+ <template v-slot:activator="{ on, attrs }">
38
+ <v-icon
39
+ v-if="!readonly && sortable"
40
+ v-bind="attrs"
41
+ v-on="on"
42
+ color="grey darken-3"
43
+ class="grey lighten-2 repeater-action repeater-add-line-index"
44
+ @click="addItem(index)"
45
+ >mdi-plus-circle-outline</v-icon
46
+ >
47
+ </template>
48
+ <span>Add here</span>
49
+ </v-tooltip>
50
+ <v-tooltip right>
51
+ <template v-slot:activator="{ on, attrs }">
52
+ <v-hover v-slot="{ hover }">
53
+ <v-icon
54
+ v-if="!readonly"
55
+ v-bind="attrs"
56
+ v-on="on"
57
+ :color="hover ? 'error' : 'grey darken-3'"
58
+ class="repeater-action repeater-remove-line"
59
+ @click="removeItem(index)"
60
+ >mdi-minus-circle-outline</v-icon
61
+ >
62
+ </v-hover>
63
+ </template>
64
+ <span>Remove</span>
65
+ </v-tooltip>
66
+ <v-icon
67
+ v-if="!readonly && sortable"
68
+ color="grey darken-3"
69
+ class="repeater-action repeater-handle-sort"
70
+ >mdi-drag</v-icon
71
+ >
72
+ </div>
73
+ </div>
74
+ <v-divider />
75
+ </div>
76
+ </draggable>
77
+ <div class="d-flex justify-end">
78
+ <v-btn
79
+ class="repeater-add-line"
80
+ @click="addItem"
81
+ :disabled="readonly"
82
+ outlined
83
+ tile
84
+ text
85
+ >
86
+ <v-icon>mdi-plus</v-icon> Add</v-btn
87
+ >
88
+ </div>
89
+ <v-dialog v-if="hasTemplates" v-model="tModalOpen" width="600" scrollable>
90
+ <v-card>
91
+ <v-card-title class="text-h5"> Select template </v-card-title>
92
+ <v-card-text>
93
+ <div class="row mt-4">
94
+ <div
95
+ v-for="(template, i) in templates"
96
+ :key="i"
97
+ class="col-12 col-md-6 pa-0"
98
+ >
99
+ <div @click="tModalCallback(template)" class="template-button">
100
+ <span class="text-h5">{{ template.name }}</span
101
+ ><br />
102
+ <span>{{ template.description }}</span>
103
+ <v-img
104
+ v-if="template.preview"
105
+ max-height="150"
106
+ min-width="250px"
107
+ :src="template.preview"
108
+ />
109
+ <v-skeleton-loader
110
+ v-else
111
+ boilerplate
112
+ min-width="250px"
113
+ type="list-item-avatar-three-line"
114
+ />
115
+ </div>
116
+ </div>
117
+ </div>
118
+ </v-card-text>
119
+ </v-card>
120
+ </v-dialog>
121
+ </div>
122
+ </template>
123
+
124
+ <style lang="scss" scoped>
125
+ .repeater-action {
126
+ display: none;
127
+ }
128
+ .repeater-side-bar {
129
+ min-width: 24px;
130
+ position: relative;
131
+ display: flex;
132
+ flex-direction: column;
133
+ align-content: center;
134
+ justify-content: center;
135
+ &:hover {
136
+ .repeater-action {
137
+ display: inline-flex;
138
+ }
139
+ }
140
+ .repeater-counter {
141
+ position: absolute;
142
+ align-self: center;
143
+ top: 10px;
144
+ }
145
+ .repeater-add-line-index {
146
+ position: absolute;
147
+ align-self: center;
148
+ top: -11px;
149
+ border-radius: 50%;
150
+ }
151
+ .repeater-handle-sort {
152
+ position: absolute;
153
+ align-self: center;
154
+ bottom: 2px;
155
+ cursor: grab;
156
+ }
157
+ }
158
+ .repeater-add-line {
159
+ border-top: none;
160
+ }
161
+ .template-button {
162
+ padding: 0.5rem;
163
+ margin: 3px;
164
+ border: solid 1px #393939;
165
+ cursor: pointer;
166
+ }
167
+ .theme--light .template-button {
168
+ border-color: #e0e0e0;
169
+ }
170
+ </style>
171
+
172
+ <script>
173
+ import draggable from "vuedraggable";
174
+
175
+ /**
176
+ * This component is made to manage a list of object that can be added/removed/reordered with a simple form.
177
+ */
178
+ export default {
179
+ name: "Repeater",
180
+ components: {
181
+ // For recursive dynamic components is better to resolve dependencies at runtime to avoid circular deps
182
+ DetailField: () => import("@mapomodule/uikit/components/Detail/DetailField.vue"),
183
+ draggable,
184
+ },
185
+ data() {
186
+ return {
187
+ items: null,
188
+ tModalOpen: false,
189
+ tModalCallback: () => {},
190
+ };
191
+ },
192
+ props: {
193
+ // V-model of the array needed to edit the objects in realtime.
194
+ value: {
195
+ type: Array,
196
+ default: () => [],
197
+ },
198
+ // The main configuration that determines the arrangement of the fields in each line.
199
+ fields: {
200
+ // [`Array<FieldConfiguration>`](/components/Detail/Detail/#fieldconfiguration)
201
+ type: Array | Object,
202
+ default: () => [],
203
+ },
204
+ // Puts the input in an error state and passes through custom error messages.
205
+ errorMessages: {
206
+ type: Array,
207
+ default: () => [],
208
+ },
209
+ // Sets input label.
210
+ label: String,
211
+ // Makes all the repeater items readonly.
212
+ readonly: Boolean,
213
+ // Makes the repeater field sortable.
214
+ sortable: Boolean,
215
+ // Make the repeater multilanguage. This means that it's going to inherit the languages and the current language from the parent detail component, creating the translations for each line of the repeater.
216
+ multilang: Boolean,
217
+ // This callback is called during sort/add/remove item if the Repeater is sortable. Use this callback to change some prop of the items in the list.
218
+ sortCallback: {
219
+ type: Function,
220
+ default: () => {},
221
+ },
222
+ langs: {
223
+ type: Array,
224
+ default: () => [],
225
+ },
226
+ currentLang: String,
227
+ },
228
+ watch: {
229
+ value(val) {
230
+ this.items = val;
231
+ },
232
+ items(val) {
233
+ this.$emit("input", val);
234
+ },
235
+ tModalOpen(val) {
236
+ !val && this.tModalCallback();
237
+ },
238
+ },
239
+ methods: {
240
+ async addItem(index) {
241
+ const element = {};
242
+ if (this.hasTemplates) {
243
+ const template = await this.chooseTemplate();
244
+ if (!template) return;
245
+ element[template.tCodeField] = template.tCode;
246
+ }
247
+ const newIndex = typeof index == "number" ? index : this.items.length;
248
+ this.items.splice(newIndex, 0, element);
249
+ this.sortable &&
250
+ this.sortCallback({
251
+ moved: { element, newIndex },
252
+ items: this.items,
253
+ eventType: "add",
254
+ });
255
+ },
256
+ removeItem(index) {
257
+ const element = this.items[index];
258
+ this.items.splice(index, 1);
259
+ this.sortable &&
260
+ this.sortCallback({
261
+ moved: { element, oldIndex: index },
262
+ items: this.items,
263
+ eventType: "remove",
264
+ });
265
+ },
266
+ async chooseTemplate() {
267
+ this.tModalOpen = true;
268
+ return new Promise((resolve) => {
269
+ this.tModalCallback = function (template) {
270
+ resolve(template);
271
+ this.tModalCallback = () => {};
272
+ this.tModalOpen = false;
273
+ };
274
+ });
275
+ },
276
+ getErrors(index) {
277
+ return (this.errorMessages || [])[index] || {};
278
+ },
279
+ parseConf(field, i) {
280
+ const conf = typeof field === "string" ? { value: field } : field;
281
+ conf.value = conf.value || "";
282
+ conf.value = this.multilang ? conf.value.replace(new RegExp(`^translations\.(${this.langs.join("|")})\.?`), "") : conf.value;
283
+ conf.slotName = `fields.${conf.value || i}`;
284
+ if (this.multilang && this.currentLang && !field.synci18n) {
285
+ const base = `translations.${this.currentLang}`;
286
+ conf.value = (conf.value && `${base}.${conf.value}`) || base;
287
+ }
288
+ if (this.readonly) {
289
+ conf.attrs = { ...conf.attrs, readonly: true };
290
+ }
291
+ return conf;
292
+ },
293
+ mapConf(fields) {
294
+ fields = this.multilang ? JSON.parse(JSON.stringify(fields)) : fields; // this hack fixes rendering loop on multilang scenario. :/
295
+ const icon = "mdi-cube-outline";
296
+ const parseGroup = (group) => typeof group === "string" ? { name: group, icon } : { ...group, icon: group.icon !== undefined ? group.icon : icon };
297
+ return fields.map((f, i) =>
298
+ f.group
299
+ ? { group: parseGroup(f.group), fields: this.mapConf(f.fields) }
300
+ : this.parseConf(f, i)
301
+ );
302
+ },
303
+ parseFields(model) {
304
+ if (this.hasTemplates) {
305
+ const template = this.templates.find(t => model[t.tCodeField] == t.tCode)
306
+ return template ? this.mapConf(template.fields) : [];
307
+ }
308
+ return this.mapConf(this.fields);
309
+ },
310
+ },
311
+ computed: {
312
+ hasTemplates() {
313
+ return typeof this.fields == "object" && !Array.isArray(this.fields);
314
+ },
315
+ templates() {
316
+ const templates = {};
317
+ if (this.hasTemplates) {
318
+ const titleCase = (string) => (string && string[0].toUpperCase() + string.slice(1).toLowerCase()) || "";
319
+ Object.keys(this.fields).forEach((tKey) => {
320
+ const tValue = this.fields[tKey];
321
+ const { preview, description } = tValue;
322
+ templates[tKey] = {
323
+ fields: tValue.fields || tValue,
324
+ name: tValue.name || titleCase(tKey.replace(/_/, " ")),
325
+ tCode: tValue.tCode || tKey,
326
+ tCodeField: tValue.tCodeField || "tCode",
327
+ preview, description,
328
+ };
329
+ });
330
+ }
331
+ return Object.values(templates);
332
+ },
333
+ },
334
+ mounted() {
335
+ this.items = this.value;
336
+ },
337
+ };
338
+ </script>
@@ -0,0 +1,89 @@
1
+ <template>
2
+ <div class="container">
3
+ <div class="preview">
4
+ <span class="preview__title">{{ getTitle }}</span>
5
+ <br />
6
+ <span class="preview__url">{{ getPermalink }}</span>
7
+ <br />
8
+ <span class="preview__desc">{{ getDescription }}</span>
9
+ </div>
10
+ </div>
11
+ </template>
12
+
13
+ <style lang="scss" scoped>
14
+ .container {
15
+ background: #ffffff;
16
+ border-radius: 3px;
17
+ }
18
+ .preview {
19
+ display: block;
20
+ max-width: 32em;
21
+ margin: 30px 8px;
22
+ &__title {
23
+ color: #035ac6;
24
+ font-size: 1.2em;
25
+ cursor: pointer;
26
+ &:hover {
27
+ text-decoration: underline;
28
+ }
29
+ }
30
+ &__url {
31
+ color: green;
32
+ font-size: 0.92em;
33
+ }
34
+ &__desc {
35
+ color: #9b9da1;
36
+ }
37
+ }
38
+ </style>
39
+
40
+ <script>
41
+ /**
42
+ * This component is used to make a preview of seo data.
43
+ */
44
+ export default {
45
+ name: "SeoPreview",
46
+ props: {
47
+ // V-model for DetailField (need to be an object `{title, permalink, description}`)
48
+ value:{
49
+ type: Object,
50
+ default: () => {}
51
+ },
52
+ // Seo title
53
+ title: {
54
+ type: String,
55
+ default:
56
+ "It was the best of times, it was the blurst of times, it was the ..."
57
+ },
58
+ // Seo permalink
59
+ permalink: {
60
+ type: String,
61
+ default: "example.com/how_to_dive"
62
+ },
63
+ // Seo description
64
+ description: {
65
+ type: String,
66
+ default:
67
+ "This is an example description that will get replaced when you start typing. Make sure to keep descriptions mobile-friendly and keyword-rich!"
68
+ }
69
+ },
70
+ computed: {
71
+ getTitle(){
72
+ if (this.value && this.value.title)
73
+ return this.value.title
74
+ return this.title
75
+ },
76
+ getPermalink(){
77
+ if (this.value && this.value.permalink)
78
+ return this.value.permalink
79
+ return this.permalink
80
+ },
81
+ getDescription(){
82
+ if (this.value && this.value.description)
83
+ return this.value.description
84
+ return this.description
85
+ }
86
+ },
87
+
88
+ };
89
+ </script>
@@ -1,10 +1,11 @@
1
1
  var useDarkMode = false;
2
2
 
3
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 toc insertdatetime advlist lists wordcount imagetools textpattern noneditable help charmap quickbars emoticons',
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
5
  // imagetools_cors_hosts: ['picsum.photos'],
6
6
  menubar: 'file edit view insert format tools table help',
7
- 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 | insertfile image mapomedia media template link anchor codesample | ltr rtl',
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',
8
9
  toolbar_sticky: true,
9
10
  image_advtab: true,
10
11
  // link_list: [
@@ -43,12 +44,13 @@ export default {
43
44
  // ],
44
45
  template_cdate_format: '[Date Created (CDATE): %m/%d/%Y : %H:%M:%S]',
45
46
  template_mdate_format: '[Date Modified (MDATE): %m/%d/%Y : %H:%M:%S]',
46
- height: 600,
47
+ height: 400,
47
48
  image_caption: true,
48
- quickbars_selection_toolbar: 'bold italic | quicklink h2 h3 blockquote quickimage quicktable',
49
+ quickbars_insert_toolbar: 'mapomedia quicktable',
50
+ quickbars_selection_toolbar: 'bold italic | quicklink h2 h3 blockquote mapomedia quicktable',
49
51
  noneditable_noneditable_class: 'mceNonEditable',
50
52
  toolbar_mode: 'sliding',
51
- contextmenu: 'link image imagetools table',
53
+ contextmenu: 'link mapomedia table',
52
54
  skin: useDarkMode ? 'oxide-dark' : 'oxide',
53
55
  content_css: useDarkMode ? 'dark' : 'default',
54
56
  content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:14px }'
@@ -1,24 +1,25 @@
1
1
  export default function (callback) {
2
2
  const pluginmanager = window.tinymce.util.Tools.resolve('tinymce.PluginManager');
3
- pluginmanager.add('mapomedia', function (editor, url) {
4
- const conf = ['mapomedia', {
3
+ const pluginname = "mapomedia"
4
+ pluginmanager.add(pluginname, function (editor, url) {
5
+ const conf = {
5
6
  icon: 'image',
6
- text: 'Mapo Media',
7
+ tooltip: 'Insert image/video/audio/docs',
7
8
  onAction: () => callback().then(html => {
8
9
  editor.focus();
9
10
  editor.undoManager.transact(() => editor.selection.setContent(html))
10
11
  editor.selection.setCursorLocation();
11
12
  editor.nodeChanged();
12
13
  }).catch(() => null)
13
- }]
14
+ }
14
15
  editor.addCommand('mceMapoMedia', () => callback().then(html => {
15
16
  editor.focus();
16
17
  editor.undoManager.transact(() => editor.selection.setContent(html))
17
18
  editor.selection.setCursorLocation();
18
19
  editor.nodeChanged();
19
20
  }).catch(() => null))
20
- editor.ui.registry.addButton(...conf);
21
- editor.ui.registry.addMenuItem(...conf);
21
+ editor.ui.registry.addButton(pluginname, conf);
22
+ editor.ui.registry.addMenuItem(pluginname, { text: "Mapo Media...", ...conf });
22
23
  return {
23
24
  getMetadata: function () {
24
25
  return {