2626 />
2727
2828 <AposButton
29+ v-if =" widgetRemoveControl "
2930 v-bind =" widgetRemoveControl "
3031 @click =" handleClick ({ action: ' remove' })"
3132 />
3738
3839import checkIfConditions from ' apostrophe/lib/universal/check-if-conditions.mjs' ;
3940
41+ const standaloneWidgetOperation = [ ' remove' ];
42+
4043export default {
4144 props: {
4245 modelValue: {
@@ -100,7 +103,7 @@ export default {
100103 ... operation,
101104 disabled,
102105 tooltip: {
103- content: ! disabled && operation .label ,
106+ content: ! disabled && ( operation .tooltip || operation . label ) ,
104107 placement: ' left'
105108 }
106109 };
@@ -133,18 +136,28 @@ export default {
133136 return controls .concat (this .widgetCustomSecondaryOperations .map (renderOperation));
134137 },
135138 widgetRemoveControl () {
139+ const { widgetOperations = [] } = this .moduleOptions ;
140+ const removeWidgetOperation = widgetOperations
141+ .find ((operation ) => operation .action === ' remove' );
142+ if (! removeWidgetOperation) {
143+ return null ;
144+ }
145+
136146 return {
137147 ... this .widgetDefaultControl ,
138- label: ' apostrophe:remove' ,
139- icon: ' trash-can-outline-icon' ,
140- disabled: this .disabled ,
148+ ... removeWidgetOperation,
141149 tooltip: {
142- content: ' apostrophe:delete ' ,
150+ content: removeWidgetOperation . tooltip ,
143151 placement: ' left'
144- },
145- action: ' remove'
152+ }
146153 };
147154 },
155+ widgetSkipControlsMap () {
156+ return new Map (
157+ (this .moduleOptions .skipOperations || [])
158+ .map (operation => [ operation, true ])
159+ );
160+ },
148161 widgetPrimaryOperations () {
149162 return this .getOperations ({ secondaryLevel: false });
150163 },
@@ -168,6 +181,9 @@ export default {
168181 getOperations ({ secondaryLevel, native }) {
169182 const { widgetOperations = [] } = this .moduleOptions ;
170183 return widgetOperations .filter (operation => {
184+ if (standaloneWidgetOperation .includes (operation .name )) {
185+ return false ;
186+ }
171187 if (
172188 typeof native === ' boolean' &&
173189 ((native && ! operation .native ) || (! native && operation .native ))
0 commit comments