Mooeypoo has uploaded a new change for review. https://gerrit.wikimedia.org/r/205339
Change subject: Add a default 'cancel' action to FragmentInspectors ...................................................................... Add a default 'cancel' action to FragmentInspectors This will automatically add a default cancel action to the common modes in the fragment inspector. However, we have to override this functionality in the annotation inspectors, since those don't really cancel their operation on dismissal. If a new inspector uses any other arbitrary modes and overrides the action set given, that inspector should be responsible to include the 'back' action for usability. Bug: T96303 Change-Id: Id9e9c77c8a1d7cad582c1a6c0408390e08008a1c --- M src/ui/inspectors/ve.ui.AnnotationInspector.js M src/ui/inspectors/ve.ui.FragmentInspector.js 2 files changed, 24 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor refs/changes/39/205339/1 diff --git a/src/ui/inspectors/ve.ui.AnnotationInspector.js b/src/ui/inspectors/ve.ui.AnnotationInspector.js index e0954a6..6651117 100644 --- a/src/ui/inspectors/ve.ui.AnnotationInspector.js +++ b/src/ui/inspectors/ve.ui.AnnotationInspector.js @@ -37,14 +37,32 @@ */ ve.ui.AnnotationInspector.static.modelClasses = []; + +// Override the parent action array to prevent having a 'cancel' button, +// since the annotation inspectors immediately apply the action and +// 'cancel' is meaningless. Instead, they use 'done' to perform the +// same dismissal after applying action that clicking away from the +// inspector performs. ve.ui.AnnotationInspector.static.actions = [ { action: 'remove', label: OO.ui.deferMsg( 'visualeditor-inspector-remove-tooltip' ), flags: 'destructive', modes: 'edit' + }, + { + action: 'done', + label: OO.ui.deferMsg( 'visualeditor-dialog-action-done' ), + flags: [ 'progressive', 'primary' ], + modes: 'edit' + }, + { + action: 'done', + label: OO.ui.deferMsg( 'visualeditor-dialog-action-insert' ), + flags: [ 'constructive', 'primary' ], + modes: 'insert' } -].concat( ve.ui.FragmentInspector.static.actions ); +]; /* Methods */ diff --git a/src/ui/inspectors/ve.ui.FragmentInspector.js b/src/ui/inspectors/ve.ui.FragmentInspector.js index fda7668..87f358e 100644 --- a/src/ui/inspectors/ve.ui.FragmentInspector.js +++ b/src/ui/inspectors/ve.ui.FragmentInspector.js @@ -30,6 +30,11 @@ ve.ui.FragmentInspector.static.actions = ve.ui.FragmentInspector.super.static.actions.concat( [ { + label: OO.ui.deferMsg( 'visualeditor-dialog-action-cancel' ), + flags: 'safe', + modes: [ 'edit', 'insert' ] + }, + { action: 'done', label: OO.ui.deferMsg( 'visualeditor-dialog-action-done' ), flags: [ 'progressive', 'primary' ], -- To view, visit https://gerrit.wikimedia.org/r/205339 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id9e9c77c8a1d7cad582c1a6c0408390e08008a1c Gerrit-PatchSet: 1 Gerrit-Project: VisualEditor/VisualEditor Gerrit-Branch: master Gerrit-Owner: Mooeypoo <mor...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits