apostrophe 3.33.0 → 3.35.0
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/.github/workflows/main.yml +3 -0
- package/CHANGELOG.md +31 -0
- package/defaults.js +2 -1
- package/index.js +2 -1
- package/modules/@apostrophecms/admin-bar/index.js +74 -0
- package/modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue +16 -6
- package/modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextModeAndSettings.vue +24 -1
- package/modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextTitle.vue +15 -0
- package/modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextUndoRedo.vue +20 -18
- package/modules/@apostrophecms/area/ui/apos/components/AposAreaEditor.vue +22 -1
- package/modules/@apostrophecms/area/ui/apos/components/AposAreaExpandedMenu.vue +35 -0
- package/modules/@apostrophecms/area/ui/apos/components/AposAreaWidget.vue +6 -1
- package/modules/@apostrophecms/asset/lib/globalIcons.js +41 -17
- package/modules/@apostrophecms/command-menu/index.js +375 -0
- package/modules/@apostrophecms/command-menu/ui/apos/apps/AposCommandMenu.js +34 -0
- package/modules/@apostrophecms/command-menu/ui/apos/components/AposCommandMenuKey.vue +94 -0
- package/modules/@apostrophecms/command-menu/ui/apos/components/AposCommandMenuKeyList.vue +106 -0
- package/modules/@apostrophecms/command-menu/ui/apos/components/AposCommandMenuShortcut.vue +223 -0
- package/modules/@apostrophecms/command-menu/ui/apos/components/TheAposCommandMenu.vue +116 -0
- package/modules/@apostrophecms/doc/index.js +9 -0
- package/modules/@apostrophecms/doc-type/index.js +117 -1
- package/modules/@apostrophecms/doc-type/ui/apos/components/AposDocContextMenu.vue +7 -0
- package/modules/@apostrophecms/i18n/i18n/de.json +446 -0
- package/modules/@apostrophecms/i18n/i18n/en.json +27 -0
- package/modules/@apostrophecms/i18n/i18n/es.json +19 -0
- package/modules/@apostrophecms/i18n/i18n/fr.json +19 -0
- package/modules/@apostrophecms/i18n/i18n/pt-BR.json +19 -0
- package/modules/@apostrophecms/i18n/i18n/sk.json +19 -0
- package/modules/@apostrophecms/image/index.js +7 -0
- package/modules/@apostrophecms/image/ui/apos/components/AposMediaManager.vue +2 -0
- package/modules/@apostrophecms/image/ui/apos/components/AposMediaUploader.vue +11 -0
- package/modules/@apostrophecms/login/index.js +1 -1
- package/modules/@apostrophecms/modal/ui/apos/apps/AposModals.js +10 -1
- package/modules/@apostrophecms/modal/ui/apos/components/AposDocsManagerToolbar.vue +38 -3
- package/modules/@apostrophecms/modal/ui/apos/components/TheAposModals.vue +32 -2
- package/modules/@apostrophecms/page/index.js +43 -1
- package/modules/@apostrophecms/page/ui/apos/components/AposPagesManager.vue +4 -0
- package/modules/@apostrophecms/piece-type/index.js +145 -20
- package/modules/@apostrophecms/piece-type/ui/apos/components/AposDocsManager.vue +5 -1
- package/modules/@apostrophecms/rich-text-widget/index.js +153 -5
- package/modules/@apostrophecms/rich-text-widget/ui/apos/apps/AposRichTextPermalinkResolver.js +28 -0
- package/modules/@apostrophecms/rich-text-widget/ui/apos/components/AposRichTextWidgetEditor.vue +88 -14
- package/modules/@apostrophecms/rich-text-widget/ui/apos/components/AposTiptapAnchor.vue +253 -0
- package/modules/@apostrophecms/rich-text-widget/ui/apos/components/AposTiptapLink.vue +134 -24
- package/modules/@apostrophecms/rich-text-widget/ui/apos/tiptap-extensions/Anchor.js +59 -0
- package/modules/@apostrophecms/rich-text-widget/ui/apos/tiptap-extensions/Default.js +12 -4
- package/modules/@apostrophecms/rich-text-widget/ui/apos/tiptap-extensions/ListItem.js +6 -0
- package/modules/@apostrophecms/schema/lib/addFieldTypes.js +17 -0
- package/modules/@apostrophecms/schema/ui/apos/components/AposInputRelationship.vue +4 -2
- package/modules/@apostrophecms/search/index.js +27 -28
- package/modules/@apostrophecms/template/views/outerLayoutBase.html +1 -0
- package/modules/@apostrophecms/ui/ui/apos/components/AposCheckbox.vue +1 -1
- package/modules/@apostrophecms/user/index.js +24 -8
- package/modules/@apostrophecms/util/index.js +13 -0
- package/package.json +2 -2
- package/test/command-menu.js +877 -0
- package/test/concurrent-array-relationships.js +0 -1
- package/test/users.js +21 -0
- package/test/utils/commands.js +204 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,42 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
|
|
4
|
+
## 3.35.0 (2022-12-21)
|
|
5
|
+
|
|
6
|
+
### Adds
|
|
7
|
+
|
|
8
|
+
* Introduced support for linking directly to other Apostrophe documents in a rich text widget. The user can choose to link to a URL, or to a page. Linking to various piece types can also be enabled with the `linkWithType` option. This is equivalent to the old `apostrophe-rich-text-permalinks` module but is included in the core in A3. See the [documentation](https://v3.docs.apostrophecms.org/guide/core-widgets.html#rich-text-widget) for details.
|
|
9
|
+
* Introduced support for the `anchor` toolbar control in the rich text editor. This allows named anchors to be inserted. These are rendered as `span` tags with the given `id` and can then be linked to via `#id`, providing basic support for internal links. HTML 4-style named anchors in legacy content (`name` on `a` tags) are automatically migrated upon first edit.
|
|
10
|
+
* German translation i18n file created for the Apostrophe Admin-UI. Thanks to [Noah Gysin](https://github.com/NoahGysin) for this contribution.
|
|
11
|
+
* Introduced support for keyboard shortcuts in admin UI. Hitting `?` will display the list of available shortcuts. Developpers can define their own shortcuts by using the new `@apostrophecms/command-menu` module and the `commands` property. Please check the [keyboard shortcut documentation](https://v3.docs.apostrophecms.org/guide/command-menu.html) for more details.
|
|
12
|
+
|
|
13
|
+
### Fixes
|
|
14
|
+
|
|
15
|
+
* The `bulletList` and `orderedList` TipTap toolbar items now work as expected.
|
|
16
|
+
* When using the autocomplete/typeahead feature of relationship fields, typing a space at the start no longer results in an error.
|
|
17
|
+
* Replace [`credential`](https://www.npmjs.com/package/credential) package with [`credentials`](https://www.npmjs.com/package/credentials) to fix the [`mout` Prototype Pollution vulnerability](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-7792). There was no actual vulnerability in Apostrophe or credential due to the way the module was actually used, and this was done to address vulnerability scan reports.
|
|
18
|
+
* Added a basic implementation of the missing "Paste from Clipboard" option to Expanded Widget Previews.
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## 3.34.0 (2022-12-12)
|
|
22
|
+
|
|
23
|
+
### Fixes
|
|
24
|
+
|
|
25
|
+
* Nested areas work properly in widgets that have the `initialModal: false` property.
|
|
26
|
+
* Apostrophe's search index now properly incorporates most string field types as in A2.
|
|
27
|
+
|
|
28
|
+
### Adds
|
|
29
|
+
|
|
30
|
+
* Relationships load more quickly.
|
|
31
|
+
* Parked page checks at startup are faster.
|
|
32
|
+
* Tasks to localize and unlocalize piece type content (see `node app help [yourModuleName]:localize` and `node app help [yourModuleName]:unlocalize`).
|
|
3
33
|
## 3.33.0 (2022-11-28)
|
|
4
34
|
|
|
5
35
|
### Adds
|
|
6
36
|
|
|
7
37
|
* You can now set `inline: true` on schema fields of type `array`. This displays a simple editing interface in the context of the main dialog box for the document in question, avoiding the need to open an additional dialog box. Usually best for cases with just one field or just a few. If your array field has a large number of subfields the default behavior (`inline: false`) is more suitable for your needs. See the [array field](https://v3.docs.apostrophecms.org/reference/field-types/array.html) documentation for more information.
|
|
8
38
|
* Batch feature for publishing pieces.
|
|
39
|
+
* Add extensibility for `rich-text-widget` `defaultOptions`. Every key will now be used in the `AposRichTextWidgetEditor`.
|
|
9
40
|
|
|
10
41
|
### Fixes
|
|
11
42
|
|
package/defaults.js
CHANGED
package/index.js
CHANGED
|
@@ -13,6 +13,80 @@ module.exports = {
|
|
|
13
13
|
// Do include a page tree button in the admin bar
|
|
14
14
|
pageTree: true
|
|
15
15
|
},
|
|
16
|
+
commands(self) {
|
|
17
|
+
return {
|
|
18
|
+
add: {
|
|
19
|
+
[`${self.__meta.name}:undo`]: {
|
|
20
|
+
type: 'item',
|
|
21
|
+
label: 'apostrophe:commandMenuUndo',
|
|
22
|
+
action: {
|
|
23
|
+
type: 'command-menu-admin-bar-undo'
|
|
24
|
+
},
|
|
25
|
+
shortcut: 'Ctrl+Z Meta+Z'
|
|
26
|
+
},
|
|
27
|
+
[`${self.__meta.name}:redo`]: {
|
|
28
|
+
type: 'item',
|
|
29
|
+
label: 'apostrophe:commandMenuRedo',
|
|
30
|
+
action: {
|
|
31
|
+
type: 'command-menu-admin-bar-redo'
|
|
32
|
+
},
|
|
33
|
+
shortcut: 'Ctrl+Shift+Z Meta+Shift+Z'
|
|
34
|
+
},
|
|
35
|
+
[`${self.__meta.name}:discard-draft`]: {
|
|
36
|
+
type: 'item',
|
|
37
|
+
label: 'apostrophe:commandMenuDiscardDraft',
|
|
38
|
+
action: {
|
|
39
|
+
type: 'command-menu-admin-bar-discard-draft'
|
|
40
|
+
},
|
|
41
|
+
shortcut: 'Ctrl+Shift+Backspace Meta+Shift+Backspace'
|
|
42
|
+
},
|
|
43
|
+
[`${self.__meta.name}:publish-draft`]: {
|
|
44
|
+
type: 'item',
|
|
45
|
+
label: 'apostrophe:commandMenuPublishDraft',
|
|
46
|
+
action: {
|
|
47
|
+
type: 'command-menu-admin-bar-publish-draft'
|
|
48
|
+
},
|
|
49
|
+
shortcut: 'Ctrl+Shift+P Meta+Shift+P'
|
|
50
|
+
},
|
|
51
|
+
[`${self.__meta.name}:toggle-edit-preview-mode`]: {
|
|
52
|
+
type: 'item',
|
|
53
|
+
label: 'apostrophe:commandMenuToggleEditPreviewMode',
|
|
54
|
+
action: {
|
|
55
|
+
type: 'command-menu-admin-bar-toggle-edit-preview'
|
|
56
|
+
},
|
|
57
|
+
shortcut: 'Ctrl+/ Meta+/'
|
|
58
|
+
},
|
|
59
|
+
[`${self.__meta.name}:toggle-published-draft-document`]: {
|
|
60
|
+
type: 'item',
|
|
61
|
+
label: 'apostrophe:commandMenuTogglePublishedDraftDocument',
|
|
62
|
+
action: {
|
|
63
|
+
type: 'command-menu-admin-bar-toggle-publish-draft'
|
|
64
|
+
},
|
|
65
|
+
shortcut: 'Ctrl+Shift+D Meta+Shift+D'
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
modal: {
|
|
69
|
+
default: {
|
|
70
|
+
'@apostrophecms/command-menu:content': {
|
|
71
|
+
label: 'apostrophe:commandMenuContent',
|
|
72
|
+
commands: [
|
|
73
|
+
`${self.__meta.name}:undo`,
|
|
74
|
+
`${self.__meta.name}:redo`,
|
|
75
|
+
`${self.__meta.name}:discard-draft`,
|
|
76
|
+
`${self.__meta.name}:publish-draft`
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
'@apostrophecms/command-menu:mode': {
|
|
80
|
+
label: 'apostrophe:commandMenuMode',
|
|
81
|
+
commands: [
|
|
82
|
+
`${self.__meta.name}:toggle-edit-preview-mode`,
|
|
83
|
+
`${self.__meta.name}:toggle-published-draft-document`
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
},
|
|
16
90
|
init(self) {
|
|
17
91
|
self.items = [];
|
|
18
92
|
self.groups = [];
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
<template v-if="contextBarActive">
|
|
4
4
|
<TheAposContextUndoRedo
|
|
5
5
|
:v-if="editMode"
|
|
6
|
-
:
|
|
7
|
-
:
|
|
6
|
+
:can-undo="canUndo"
|
|
7
|
+
:can-redo="canRedo"
|
|
8
8
|
@undo="undo"
|
|
9
9
|
@redo="redo"
|
|
10
10
|
:retrying="retrying"
|
|
@@ -122,6 +122,12 @@ export default {
|
|
|
122
122
|
},
|
|
123
123
|
customPublishLabel() {
|
|
124
124
|
return (this.hasCustomUi && apos.modules[this.context.type].publishLabel) || null;
|
|
125
|
+
},
|
|
126
|
+
canUndo() {
|
|
127
|
+
return this.patchesSinceLoaded.length > 0;
|
|
128
|
+
},
|
|
129
|
+
canRedo() {
|
|
130
|
+
return this.undone.length > 0;
|
|
125
131
|
}
|
|
126
132
|
},
|
|
127
133
|
watch: {
|
|
@@ -598,12 +604,16 @@ export default {
|
|
|
598
604
|
}
|
|
599
605
|
},
|
|
600
606
|
async undo() {
|
|
601
|
-
|
|
602
|
-
|
|
607
|
+
if (this.canUndo) {
|
|
608
|
+
this.undone.push(this.patchesSinceLoaded.pop());
|
|
609
|
+
await this.refreshAfterHistoryChange('apostrophe:undoFailed');
|
|
610
|
+
}
|
|
603
611
|
},
|
|
604
612
|
async redo() {
|
|
605
|
-
|
|
606
|
-
|
|
613
|
+
if (this.canRedo) {
|
|
614
|
+
this.patchesSinceLoaded.push(this.undone.pop());
|
|
615
|
+
await this.refreshAfterHistoryChange('apostrophe:redoFailed');
|
|
616
|
+
}
|
|
607
617
|
},
|
|
608
618
|
async refreshAfterHistoryChange(errorMessageKey) {
|
|
609
619
|
this.saving = true;
|
package/modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextModeAndSettings.vue
CHANGED
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
:show-preview="false"
|
|
37
37
|
/>
|
|
38
38
|
<AposButton
|
|
39
|
-
v-if="
|
|
39
|
+
v-if="canSwitchToPreviewMode"
|
|
40
40
|
class="apos-admin-bar__context-button"
|
|
41
41
|
label="apostrophe:preview" :tooltip="{
|
|
42
42
|
content: 'apostrophe:previewTooltip',
|
|
@@ -127,16 +127,39 @@ export default {
|
|
|
127
127
|
},
|
|
128
128
|
hasBeenPublishedThisPageload() {
|
|
129
129
|
return (this.context.lastPublishedAt > this.mountedAt) || ((this.context.submitted && this.context.submitted.at) > this.mountedAt);
|
|
130
|
+
},
|
|
131
|
+
canSwitchToEditMode() {
|
|
132
|
+
return !this.editMode;
|
|
133
|
+
},
|
|
134
|
+
canSwitchToPreviewMode() {
|
|
135
|
+
return this.editMode && !this.hasCustomUI;
|
|
130
136
|
}
|
|
131
137
|
},
|
|
132
138
|
mounted() {
|
|
133
139
|
this.mountedAt = (new Date()).toISOString();
|
|
140
|
+
apos.bus.$on('command-menu-admin-bar-toggle-edit-preview', this.toggleEditPreviewMode);
|
|
141
|
+
apos.bus.$on('command-menu-admin-bar-publish-draft', this.onPublish);
|
|
142
|
+
},
|
|
143
|
+
destroyed() {
|
|
144
|
+
apos.bus.$off('command-menu-admin-bar-toggle-edit-preview', this.toggleEditPreviewMode);
|
|
145
|
+
apos.bus.$off('command-menu-admin-bar-publish-draft', this.onPublish);
|
|
134
146
|
},
|
|
135
147
|
methods: {
|
|
148
|
+
toggleEditPreviewMode() {
|
|
149
|
+
if (this.canSwitchToEditMode) {
|
|
150
|
+
this.switchEditMode(true);
|
|
151
|
+
} else if (this.canSwitchToPreviewMode) {
|
|
152
|
+
this.switchEditMode(false);
|
|
153
|
+
}
|
|
154
|
+
},
|
|
136
155
|
switchEditMode(mode) {
|
|
137
156
|
this.$emit('switch-edit-mode', mode);
|
|
138
157
|
},
|
|
139
158
|
onPublish() {
|
|
159
|
+
if (!this.editMode || !this.readyToPublish) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
|
|
140
163
|
if (!this.context.lastPublishedAt) {
|
|
141
164
|
this.hasBeenPublishedButNotUpdated = true;
|
|
142
165
|
} else {
|
|
@@ -102,9 +102,24 @@ export default {
|
|
|
102
102
|
modifiers: (this.draftMode === 'published') ? [ 'disabled', 'selected' ] : null
|
|
103
103
|
}
|
|
104
104
|
];
|
|
105
|
+
},
|
|
106
|
+
canTogglePublishDraftMode() {
|
|
107
|
+
return !this.isUnpublished && !this.hasCustomUi;
|
|
105
108
|
}
|
|
106
109
|
},
|
|
110
|
+
mounted() {
|
|
111
|
+
apos.bus.$on('command-menu-admin-bar-toggle-publish-draft', this.togglePublishDraftMode);
|
|
112
|
+
},
|
|
113
|
+
destroyed() {
|
|
114
|
+
apos.bus.$off('command-menu-admin-bar-toggle-publish-draft', this.togglePublishDraftMode);
|
|
115
|
+
},
|
|
107
116
|
methods: {
|
|
117
|
+
togglePublishDraftMode() {
|
|
118
|
+
if (this.canTogglePublishDraftMode) {
|
|
119
|
+
const mode = this.draftMode === 'draft' ? 'published' : 'draft';
|
|
120
|
+
this.switchDraftMode(mode);
|
|
121
|
+
}
|
|
122
|
+
},
|
|
108
123
|
switchDraftMode(mode) {
|
|
109
124
|
this.$emit('switch-draft-mode', mode);
|
|
110
125
|
}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
v-apos-tooltip="undoTooltips.undo"
|
|
11
11
|
>
|
|
12
12
|
<AposButton
|
|
13
|
-
:disabled="
|
|
13
|
+
:disabled="!canUndo"
|
|
14
14
|
type="subtle" :modifiers="['small', 'no-motion']"
|
|
15
15
|
label="apostrophe:undo" class="apos-admin-bar__context-button"
|
|
16
16
|
icon="undo-icon" :icon-only="true"
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
v-apos-tooltip="undoTooltips.redo"
|
|
23
23
|
>
|
|
24
24
|
<AposButton
|
|
25
|
-
:disabled="
|
|
25
|
+
:disabled="!canRedo"
|
|
26
26
|
type="subtle" :modifiers="['small', 'no-motion']"
|
|
27
27
|
label="apostrophe:redo" class="apos-admin-bar__context-button"
|
|
28
28
|
icon="redo-icon" :icon-only="true"
|
|
@@ -44,18 +44,8 @@
|
|
|
44
44
|
export default {
|
|
45
45
|
name: 'TheAposContextUndoRedo',
|
|
46
46
|
props: {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
default() {
|
|
50
|
-
return [];
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
undone: {
|
|
54
|
-
type: Array,
|
|
55
|
-
default() {
|
|
56
|
-
return [];
|
|
57
|
-
}
|
|
58
|
-
},
|
|
47
|
+
canUndo: Boolean,
|
|
48
|
+
canRedo: Boolean,
|
|
59
49
|
retrying: Boolean,
|
|
60
50
|
editing: Boolean,
|
|
61
51
|
saving: Boolean,
|
|
@@ -69,23 +59,35 @@ export default {
|
|
|
69
59
|
redo: 'apostrophe:redoTooltip'
|
|
70
60
|
};
|
|
71
61
|
|
|
72
|
-
if (this.
|
|
62
|
+
if (!this.canUndo) {
|
|
73
63
|
tooltips.undo = 'apostrophe:undoTooltipNoChanges';
|
|
74
64
|
}
|
|
75
65
|
|
|
76
|
-
if (this.
|
|
66
|
+
if (!this.canRedo) {
|
|
77
67
|
tooltips.redo = 'apostrophe:redoTooltipNoChanges';
|
|
78
68
|
}
|
|
79
69
|
|
|
80
70
|
return tooltips;
|
|
81
71
|
}
|
|
82
72
|
},
|
|
73
|
+
mounted() {
|
|
74
|
+
apos.bus.$on('command-menu-admin-bar-undo', this.undo);
|
|
75
|
+
apos.bus.$on('command-menu-admin-bar-redo', this.redo);
|
|
76
|
+
},
|
|
77
|
+
destroyed() {
|
|
78
|
+
apos.bus.$off('command-menu-admin-bar-undo', this.undo);
|
|
79
|
+
apos.bus.$off('command-menu-admin-bar-redo', this.redo);
|
|
80
|
+
},
|
|
83
81
|
methods: {
|
|
84
82
|
undo() {
|
|
85
|
-
this
|
|
83
|
+
if (this.canUndo) {
|
|
84
|
+
this.$emit('undo');
|
|
85
|
+
}
|
|
86
86
|
},
|
|
87
87
|
redo() {
|
|
88
|
-
this
|
|
88
|
+
if (this.canRedo) {
|
|
89
|
+
this.$emit('redo');
|
|
90
|
+
}
|
|
89
91
|
}
|
|
90
92
|
}
|
|
91
93
|
};
|
|
@@ -446,9 +446,10 @@ export default {
|
|
|
446
446
|
index
|
|
447
447
|
});
|
|
448
448
|
} else if (!this.widgetHasInitialModal(name)) {
|
|
449
|
+
const widget = this.newWidget(name);
|
|
449
450
|
return this.insert({
|
|
450
451
|
widget: {
|
|
451
|
-
|
|
452
|
+
...widget,
|
|
452
453
|
aposPlaceholder: this.widgetHasPlaceholder(name)
|
|
453
454
|
},
|
|
454
455
|
index
|
|
@@ -561,6 +562,26 @@ export default {
|
|
|
561
562
|
}
|
|
562
563
|
return window.apos.modules[`${item.type}-widget`];
|
|
563
564
|
});
|
|
565
|
+
},
|
|
566
|
+
// Return a new widget object in which defaults are fully populated,
|
|
567
|
+
// especially valid sub-area objects, so that nested edits work on the page
|
|
568
|
+
newWidget(type) {
|
|
569
|
+
const widget = {
|
|
570
|
+
type
|
|
571
|
+
};
|
|
572
|
+
const schema = apos.modules[apos.area.widgetManagers[type]].schema;
|
|
573
|
+
schema.forEach(field => {
|
|
574
|
+
if (field.type === 'area') {
|
|
575
|
+
widget[field.name] = {
|
|
576
|
+
_id: cuid(),
|
|
577
|
+
metaType: 'area',
|
|
578
|
+
items: []
|
|
579
|
+
};
|
|
580
|
+
} else {
|
|
581
|
+
widget[field.name] = field.def ? klona(field.def) : field.def;
|
|
582
|
+
}
|
|
583
|
+
});
|
|
584
|
+
return widget;
|
|
564
585
|
}
|
|
565
586
|
}
|
|
566
587
|
};
|
|
@@ -117,11 +117,46 @@ export default {
|
|
|
117
117
|
'apos.expanded-menu: No groups or widgets defined. Please, either add a groups or widgets property to your area configuration.'
|
|
118
118
|
);
|
|
119
119
|
}
|
|
120
|
+
|
|
121
|
+
const clipboard = this.getClipboard();
|
|
122
|
+
this.groups = clipboard
|
|
123
|
+
? [ clipboard ].concat(this.groups)
|
|
124
|
+
: this.groups;
|
|
120
125
|
},
|
|
121
126
|
methods: {
|
|
122
127
|
isValidColumn(count) {
|
|
123
128
|
return count ? +count > 1 && +count < 4 : true;
|
|
124
129
|
},
|
|
130
|
+
getClipboard() {
|
|
131
|
+
const clipboard = apos.area.widgetClipboard.get();
|
|
132
|
+
if (!clipboard) {
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const widgets = this.groups.flatMap(group => Object.values(group.widgets));
|
|
137
|
+
const matchingChoice = widgets.find(widget => widget.name === clipboard.type);
|
|
138
|
+
if (!matchingChoice) {
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const group = {
|
|
143
|
+
label: 'Clipboard',
|
|
144
|
+
widgets: [
|
|
145
|
+
{
|
|
146
|
+
type: 'clipboard',
|
|
147
|
+
...matchingChoice,
|
|
148
|
+
label: {
|
|
149
|
+
key: 'apostrophe:pasteWidget',
|
|
150
|
+
widget: this.$t(matchingChoice.label)
|
|
151
|
+
},
|
|
152
|
+
clipboard
|
|
153
|
+
}
|
|
154
|
+
],
|
|
155
|
+
columns: 1
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
return group;
|
|
159
|
+
},
|
|
125
160
|
createGroup(config) {
|
|
126
161
|
const group = {
|
|
127
162
|
columns: +config.columns || 3,
|
|
@@ -268,7 +268,12 @@ export default {
|
|
|
268
268
|
};
|
|
269
269
|
},
|
|
270
270
|
widgetLabel() {
|
|
271
|
-
|
|
271
|
+
const moduleName = `${this.widget.type}-widget`;
|
|
272
|
+
const module = window.apos.modules[moduleName];
|
|
273
|
+
if (!module) {
|
|
274
|
+
console.error(`No ${moduleName} module found for widget type ${this.widget.type}`);
|
|
275
|
+
}
|
|
276
|
+
return module.label;
|
|
272
277
|
},
|
|
273
278
|
widgetOptions() {
|
|
274
279
|
return this.widgets[this.widget.type];
|
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
// Alphabetical collection of globally available vue-material-design-icons.
|
|
2
2
|
module.exports = {
|
|
3
3
|
'account-box-icon': 'AccountBox',
|
|
4
|
-
'alpha-x-icon': 'AlphaX',
|
|
5
4
|
'alert-circle-icon': 'AlertCircle',
|
|
6
|
-
'
|
|
7
|
-
'
|
|
5
|
+
'alpha-x-icon': 'AlphaX',
|
|
6
|
+
'anchor-icon': 'Anchor',
|
|
7
|
+
'apple-keyboard-caps': 'AppleKeyboardCaps',
|
|
8
|
+
'apple-keyboard-command': 'AppleKeyboardCommand',
|
|
9
|
+
'apple-keyboard-control': 'AppleKeyboardControl',
|
|
10
|
+
'apple-keyboard-option': 'AppleKeyboardOption',
|
|
11
|
+
'apple-keyboard-shift': 'AppleKeyboardShift',
|
|
8
12
|
'archive-arrow-down-icon': 'ArchiveArrowDown',
|
|
9
13
|
'archive-arrow-up-icon': 'ArchiveArrowUp',
|
|
14
|
+
'arrow-down-icon': 'ArrowDown',
|
|
15
|
+
'arrow-left-icon': 'ArrowLeft',
|
|
10
16
|
'arrow-right-icon': 'ArrowRight',
|
|
17
|
+
'arrow-up-icon': 'ArrowUp',
|
|
11
18
|
'calendar-icon': 'Calendar',
|
|
12
|
-
'checkbox-blank-icon': 'CheckboxBlankOutline',
|
|
13
19
|
'check-all-icon': 'CheckAll',
|
|
14
20
|
'check-bold-icon': 'CheckBold',
|
|
15
21
|
'check-circle-icon': 'CheckCircle',
|
|
16
22
|
'check-decagram-icon': 'CheckDecagram',
|
|
23
|
+
'checkbox-blank-icon': 'CheckboxBlankOutline',
|
|
17
24
|
'checkbox-marked-icon': 'CheckboxMarked',
|
|
18
25
|
'chevron-down-icon': 'ChevronDown',
|
|
19
26
|
'chevron-left-icon': 'ChevronLeft',
|
|
@@ -21,57 +28,74 @@ module.exports = {
|
|
|
21
28
|
'chevron-up-icon': 'ChevronUp',
|
|
22
29
|
'circle-icon': 'Circle',
|
|
23
30
|
'circle-medium-icon': 'CircleMedium',
|
|
31
|
+
'clipboard-plus-icon': 'ClipboardPlus',
|
|
32
|
+
'clipboard-plus-outline-icon': 'ClipboardPlusOutline',
|
|
24
33
|
'clock-icon': 'Clock',
|
|
25
34
|
'close-circle-icon': 'CloseCircle',
|
|
26
35
|
'close-icon': 'Close',
|
|
27
36
|
'cloud-upload-icon': 'CloudUpload',
|
|
28
37
|
'code-tags-icon': 'CodeTags',
|
|
29
38
|
'cog-icon': 'Cog',
|
|
30
|
-
'cursor-default-click-icon': 'CursorDefaultClick',
|
|
31
39
|
'content-copy-icon': 'ContentCopy',
|
|
32
|
-
'clipboard-plus-icon': 'ClipboardPlus',
|
|
33
|
-
'clipboard-plus-outline-icon': 'ClipboardPlusOutline',
|
|
34
|
-
'delete-icon': 'Delete',
|
|
35
40
|
'content-cut-icon': 'ContentCut',
|
|
41
|
+
'cursor-default-click-icon': 'CursorDefaultClick',
|
|
42
|
+
'delete-icon': 'Delete',
|
|
36
43
|
'dots-vertical-icon': 'DotsVertical',
|
|
37
44
|
'drag-icon': 'Apps',
|
|
38
45
|
'eye-icon': 'Eye',
|
|
39
|
-
'file-tree-icon': 'FileTree',
|
|
40
46
|
'file-document-icon': 'FileDocument',
|
|
47
|
+
'file-tree-icon': 'FileTree',
|
|
41
48
|
'flare-icon': 'Flare',
|
|
42
49
|
'format-align-center-icon': 'FormatAlignCenter',
|
|
43
50
|
'format-align-justify-icon': 'FormatAlignJustify',
|
|
44
51
|
'format-align-left-icon': 'FormatAlignLeft',
|
|
45
52
|
'format-align-right-icon': 'FormatAlignRight',
|
|
46
53
|
'format-bold-icon': 'FormatBold',
|
|
54
|
+
'format-italic-icon': 'FormatItalic',
|
|
47
55
|
'format-list-bulleted-icon': 'FormatListBulleted',
|
|
48
56
|
'format-list-numbered-icon': 'FormatListNumbered',
|
|
49
|
-
'format-
|
|
57
|
+
'format-quote-close-icon': 'FormatQuoteClose',
|
|
50
58
|
'format-strikethrough-variant-icon': 'FormatStrikethroughVariant',
|
|
51
59
|
'format-underline-icon': 'FormatUnderline',
|
|
52
|
-
'format-quote-close-icon': 'FormatQuoteClose',
|
|
53
60
|
'help-circle-icon': 'HelpCircle',
|
|
54
|
-
'information-outline-icon': 'InformationOutline',
|
|
55
|
-
'information-icon': 'Information',
|
|
56
61
|
'image-edit-outline': 'ImageEditOutline',
|
|
57
62
|
'image-icon': 'Image',
|
|
58
63
|
'image-size-select-actual-icon': 'ImageSizeSelectActual',
|
|
59
|
-
'
|
|
64
|
+
'information-icon': 'Information',
|
|
65
|
+
'information-outline-icon': 'InformationOutline',
|
|
60
66
|
'instagram-icon': 'Instagram',
|
|
67
|
+
'keyboard-backspace': 'KeyboardBackspace',
|
|
68
|
+
'keyboard-esc': 'KeyboardEsc',
|
|
69
|
+
'keyboard-f1': 'KeyboardF1',
|
|
70
|
+
'keyboard-f10': 'KeyboardF10',
|
|
71
|
+
'keyboard-f11': 'KeyboardF11',
|
|
72
|
+
'keyboard-f12': 'KeyboardF12',
|
|
73
|
+
'keyboard-f2': 'KeyboardF2',
|
|
74
|
+
'keyboard-f3': 'KeyboardF3',
|
|
75
|
+
'keyboard-f4': 'KeyboardF4',
|
|
76
|
+
'keyboard-f5': 'KeyboardF5',
|
|
77
|
+
'keyboard-f6': 'KeyboardF6',
|
|
78
|
+
'keyboard-f7': 'KeyboardF7',
|
|
79
|
+
'keyboard-f8': 'KeyboardF8',
|
|
80
|
+
'keyboard-f9': 'KeyboardF9',
|
|
81
|
+
'keyboard-return': 'KeyboardReturn',
|
|
82
|
+
'keyboard-space': 'KeyboardSpace',
|
|
83
|
+
'keyboard-tab': 'KeyboardTab',
|
|
61
84
|
'label-icon': 'Label',
|
|
62
85
|
'lightbulb-on-icon': 'LightbulbOn',
|
|
63
86
|
'link-icon': 'Link',
|
|
64
87
|
'list-status-icon': 'ListStatus',
|
|
65
88
|
'lock-icon': 'Lock',
|
|
66
|
-
'map-marker-icon': 'MapMarker',
|
|
67
89
|
'magnify-icon': 'Magnify',
|
|
90
|
+
'map-marker-icon': 'MapMarker',
|
|
68
91
|
'menu-down-icon': 'MenuDown',
|
|
69
|
-
'minus-icon': 'Minus',
|
|
70
92
|
'minus-box-icon': 'MinusBox',
|
|
93
|
+
'minus-icon': 'Minus',
|
|
71
94
|
'paperclip-icon': 'Paperclip',
|
|
72
95
|
'pencil-icon': 'Pencil',
|
|
73
|
-
'plus-icon': 'Plus',
|
|
74
96
|
'phone-icon': 'Phone',
|
|
97
|
+
'play-box-icon': 'PlayBox',
|
|
98
|
+
'plus-icon': 'Plus',
|
|
75
99
|
'redo-icon': 'RedoVariant',
|
|
76
100
|
'refresh-icon': 'Refresh',
|
|
77
101
|
'sign-text-icon': 'SignText',
|