Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

### Changes

- Changes handling of `order` and `groups` in the `admin-bar` module to respect, rather that reverse, the order of items
* Changes handling of `order` and `groups` in the `admin-bar` module to respect, rather that reverse, the order of items
* Interacting with the text inside a rich text widget will hide the widget controls to prevent awkawrd text selection.

### Fixes

Expand Down
16 changes: 12 additions & 4 deletions modules/@apostrophecms/area/ui/apos/components/AposAreaWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@
class="apos-area-widget-controls apos-area-widget__label"
:class="labelsClasses"
>
<ol class="apos-area-widget__breadcrumbs">
<ol
@click="isSuppressingWidgetControls = false"
class="apos-area-widget__breadcrumbs"

Check warning on line 30 in modules/@apostrophecms/area/ui/apos/components/AposAreaWidget.vue

View workflow job for this annotation

GitHub Actions / build (18, 6)

Attribute "class" should go before "@click"

Check warning on line 30 in modules/@apostrophecms/area/ui/apos/components/AposAreaWidget.vue

View workflow job for this annotation

GitHub Actions / build (18, 8)

Attribute "class" should go before "@click"

Check warning on line 30 in modules/@apostrophecms/area/ui/apos/components/AposAreaWidget.vue

View workflow job for this annotation

GitHub Actions / build (20, 8)

Attribute "class" should go before "@click"

Check warning on line 30 in modules/@apostrophecms/area/ui/apos/components/AposAreaWidget.vue

View workflow job for this annotation

GitHub Actions / build (22, 7)

Attribute "class" should go before "@click"

Check warning on line 30 in modules/@apostrophecms/area/ui/apos/components/AposAreaWidget.vue

View workflow job for this annotation

GitHub Actions / build (20, 6)

Attribute "class" should go before "@click"

Check warning on line 30 in modules/@apostrophecms/area/ui/apos/components/AposAreaWidget.vue

View workflow job for this annotation

GitHub Actions / build (22, 8)

Attribute "class" should go before "@click"

Check warning on line 30 in modules/@apostrophecms/area/ui/apos/components/AposAreaWidget.vue

View workflow job for this annotation

GitHub Actions / build (22, 6)

Attribute "class" should go before "@click"

Check warning on line 30 in modules/@apostrophecms/area/ui/apos/components/AposAreaWidget.vue

View workflow job for this annotation

GitHub Actions / build (18, 7)

Attribute "class" should go before "@click"

Check warning on line 30 in modules/@apostrophecms/area/ui/apos/components/AposAreaWidget.vue

View workflow job for this annotation

GitHub Actions / build (20, 7)

Attribute "class" should go before "@click"
>
<li
class="
apos-area-widget__breadcrumb
Expand Down Expand Up @@ -135,6 +138,7 @@
:doc-id="docId"
:focused="isFocused"
@update="$emit('update', $event)"
@suppress-widget-controls="isSuppressingWidgetControls = true"
/>
<component
:is="widgetComponent(widget.type)"
Expand Down Expand Up @@ -285,12 +289,14 @@
mounted: false, // hack around needing DOM to be rendered for computed classes
isSuppressed: false,
menuOpen: null,
isSuppressingWidgetControls: false,
classes: {
show: 'apos-is-visible',
open: 'apos-is-open',
focus: 'apos-is-focused',
highlight: 'apos-is-highlighted',
adjust: 'apos-is-ui-adjusted'
adjust: 'apos-is-ui-adjusted',
suppressWidgetControls: 'apos-is-suppressing-widget-controls'
},
breadcrumbs: {
$lastEl: null,
Expand Down Expand Up @@ -362,7 +368,8 @@
},
controlsClasses() {
return {
[this.classes.show]: this.isFocused
[this.classes.show]: this.isFocused,
[this.classes.suppressWidgetControls]: this.isSuppressingWidgetControls
};
},
containerClasses() {
Expand Down Expand Up @@ -398,6 +405,7 @@
} else {
this.menuOpen = null;
this.$refs.wrapper.removeEventListener('keydown', this.handleKeyboardUnfocus);
this.isSuppressingWidgetControls = false;
}
}
},
Expand Down Expand Up @@ -881,7 +889,7 @@
}
}

.apos-is-visible,
.apos-is-visible:not(.apos-is-suppressing-widget-controls),
.apos-is-focused {
opacity: 1;
pointer-events: auto;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export default {
default: false
}
},
emits: [ 'update' ],
emits: [ 'update', 'suppressWidgetControls' ],
data() {
return {
editor: null,
Expand All @@ -209,6 +209,8 @@ export default {
showPlaceholder: null,
activeInsertMenuComponent: false,
suppressInsertMenu: false,
suppressWidgetControls: false,
hasSelection: false,
insertMenuKey: null,
openedPopover: false
};
Expand Down Expand Up @@ -377,8 +379,14 @@ export default {
}
},
watch: {
suppressWidgetControls(newVal) {
if (newVal) {
this.$emit('suppressWidgetControls');
}
},
isFocused(newVal) {
if (!newVal) {
this.suppressWidgetControls = false;
if (this.pending) {
this.emitWidgetUpdate();
}
Expand Down Expand Up @@ -463,6 +471,13 @@ export default {
this.$nextTick(() => {
this.showPlaceholder = true;
});
},
onSelectionUpdate: ({ editor }) => {
this.$nextTick(() => {
if (!editor.view.state.selection.empty) {
this.suppressWidgetControls = true;
}
});
}
});
apos.bus.$on('apos-refreshing', this.onAposRefreshing);
Expand Down Expand Up @@ -501,6 +516,7 @@ export default {
} else {
this.suppressInsertMenu = false;
}
this.suppressWidgetControls = true;
},
doSuppressInsertMenu() {
this.suppressInsertMenu = true;
Expand Down