mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-28 00:00:49 +00:00
Merge "Use different tooltips for ca-edit and ca-ve-edit links"
This commit is contained in:
commit
e2efe5079a
|
@ -370,10 +370,14 @@
|
||||||
"accesskey-ca-editsource",
|
"accesskey-ca-editsource",
|
||||||
"accesskey-ca-ve-edit",
|
"accesskey-ca-ve-edit",
|
||||||
"pipe-separator",
|
"pipe-separator",
|
||||||
"tooltip-ca-createsource",
|
"tooltip-ca-ve-edit",
|
||||||
"tooltip-ca-edit",
|
"tooltip-ca-ve-create",
|
||||||
|
"tooltip-ca-ve-edit-local",
|
||||||
|
"tooltip-ca-ve-create-local",
|
||||||
"tooltip-ca-editsource",
|
"tooltip-ca-editsource",
|
||||||
"tooltip-ca-ve-edit"
|
"tooltip-ca-createsource",
|
||||||
|
"tooltip-ca-editsource-local",
|
||||||
|
"tooltip-ca-createsource-local"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"ext.visualEditor.desktopArticleTarget.noscript": {
|
"ext.visualEditor.desktopArticleTarget.noscript": {
|
||||||
|
|
|
@ -17,15 +17,25 @@
|
||||||
"Zoranzoki21"
|
"Zoranzoki21"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"accesskey-ca-editsource": "e",
|
|
||||||
"accesskey-ca-ve-edit": "v",
|
"accesskey-ca-ve-edit": "v",
|
||||||
|
"accesskey-ca-ve-edit-local": "v",
|
||||||
|
"accesskey-ca-ve-create": "v",
|
||||||
|
"accesskey-ca-ve-create-local": "v",
|
||||||
|
"accesskey-ca-editsource": "e",
|
||||||
|
"accesskey-ca-editsource-local": "e",
|
||||||
|
"accesskey-ca-createsource": "e",
|
||||||
|
"accesskey-ca-createsource-local": "e",
|
||||||
"collabpad-doctitle": "CollabPad: $1",
|
"collabpad-doctitle": "CollabPad: $1",
|
||||||
"collabpad-import-subtitle": "Imported from $1",
|
"collabpad-import-subtitle": "Imported from $1",
|
||||||
"collabpad": "CollabPad",
|
"collabpad": "CollabPad",
|
||||||
"tooltip-ca-createsource": "Create the source code of this page",
|
|
||||||
"tooltip-ca-edit": "Edit this page using wikitext",
|
|
||||||
"tooltip-ca-editsource": "Edit the source code of this page",
|
|
||||||
"tooltip-ca-ve-edit": "Edit this page",
|
"tooltip-ca-ve-edit": "Edit this page",
|
||||||
|
"tooltip-ca-ve-edit-local": "Edit the local description page",
|
||||||
|
"tooltip-ca-ve-create": "Create this page",
|
||||||
|
"tooltip-ca-ve-create-local": "Create the local description page",
|
||||||
|
"tooltip-ca-editsource": "Edit the source code of this page",
|
||||||
|
"tooltip-ca-editsource-local": "Edit the source code of the local description page",
|
||||||
|
"tooltip-ca-createsource": "Create the source code of this page",
|
||||||
|
"tooltip-ca-createsource-local": "Create the source code of the local description page",
|
||||||
"visualeditor-advancedsettings-tool": "Advanced settings",
|
"visualeditor-advancedsettings-tool": "Advanced settings",
|
||||||
"visualeditor-annotations-default-description": "This part of the page is part of an annotation range.",
|
"visualeditor-annotations-default-description": "This part of the page is part of an annotation range.",
|
||||||
"visualeditor-annotations-default-end": "End of the annotated range",
|
"visualeditor-annotations-default-end": "End of the annotated range",
|
||||||
|
|
|
@ -38,15 +38,25 @@
|
||||||
"Ата"
|
"Ата"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"accesskey-ca-editsource": "{{doc-accesskey}}",
|
|
||||||
"accesskey-ca-ve-edit": "{{doc-accesskey}}",
|
"accesskey-ca-ve-edit": "{{doc-accesskey}}",
|
||||||
|
"accesskey-ca-ve-edit-local": "{{doc-accesskey}}",
|
||||||
|
"accesskey-ca-ve-create": "{{doc-accesskey}}",
|
||||||
|
"accesskey-ca-ve-create-local": "{{doc-accesskey}}",
|
||||||
|
"accesskey-ca-editsource": "{{doc-accesskey}}",
|
||||||
|
"accesskey-ca-editsource-local": "{{doc-accesskey}}",
|
||||||
|
"accesskey-ca-createsource": "{{doc-accesskey}}",
|
||||||
|
"accesskey-ca-createsource-local": "{{doc-accesskey}}",
|
||||||
"collabpad-doctitle": "Name of CollabPad special page with a document subtitle",
|
"collabpad-doctitle": "Name of CollabPad special page with a document subtitle",
|
||||||
"collabpad-import-subtitle": "Subtitle of CollabPad page, linking to the page the content was imported from",
|
"collabpad-import-subtitle": "Subtitle of CollabPad page, linking to the page the content was imported from",
|
||||||
"collabpad": "Name of CollabPad special page",
|
"collabpad": "Name of CollabPad special page",
|
||||||
"tooltip-ca-createsource": "Tooltip of the {{msg-mw|Visualeditor-ca-createsource}} tab, used if the page does not exist.\n\nSee also:\n* {{msg-mw|Tooltip-ca-editsource}} - tooltip of the {{msg-mw|Visualeditor-ca-editsource}} tab, used if the page already exists",
|
|
||||||
"tooltip-ca-edit": "Over-ridden tooltip of the wikitext \"Edit source\" tab.",
|
|
||||||
"tooltip-ca-editsource": "Tooltip of the {{msg-mw|Visualeditor-ca-editsource}} tab, used if the page already exists.\n\nSee also:\n* {{msg-mw|Tooltip-ca-createsource}} - tooltip of the {{msg-mw|Visualeditor-ca-createsource}} tab, used if the page does not exist",
|
|
||||||
"tooltip-ca-ve-edit": "Tooltip of the dedicated VisualEditor \"Edit\" tab.\n{{Identical|Edit this page}}",
|
"tooltip-ca-ve-edit": "Tooltip of the dedicated VisualEditor \"Edit\" tab.\n{{Identical|Edit this page}}",
|
||||||
|
"tooltip-ca-ve-edit-local": "Tooltip of the dedicated VisualEditor \"Edit local description\" tab.",
|
||||||
|
"tooltip-ca-ve-create": "Tooltip of the dedicated VisualEditor \"Create\" tab.",
|
||||||
|
"tooltip-ca-ve-create-local": "Tooltip of the dedicated VisualEditor \"Add local description\" tab.",
|
||||||
|
"tooltip-ca-editsource": "Tooltip of the {{msg-mw|Visualeditor-ca-editsource}} tab, used if the page already exists.\n\nSee also:\n* {{msg-mw|Tooltip-ca-createsource}} - tooltip of the {{msg-mw|Visualeditor-ca-createsource}} tab, used if the page does not exist",
|
||||||
|
"tooltip-ca-editsource-local": "Tooltip of the {{msg-mw|Visualeditor-ca-editlocaldescriptionsource}} tab, used if the page already exists.\n\nSee also:\n* {{msg-mw|Tooltip-ca-createsource-local}} - tooltip of the {{msg-mw|Visualeditor-ca-createlocaldescriptionsource}} tab, used if the page does not exist",
|
||||||
|
"tooltip-ca-createsource": "Tooltip of the {{msg-mw|Visualeditor-ca-createsource}} tab, used if the page does not exist.\n\nSee also:\n* {{msg-mw|Tooltip-ca-editsource}} - tooltip of the {{msg-mw|Visualeditor-ca-editsource}} tab, used if the page already exists",
|
||||||
|
"tooltip-ca-createsource-local": "Tooltip of the {{msg-mw|Visualeditor-ca-createlocaldescriptionsource}} tab, used if the page does not exist.\n\nSee also:\n* {{msg-mw|Tooltip-ca-editsource-local}} - tooltip of the {{msg-mw|Visualeditor-ca-editlocaldescriptionsource}} tab, used if the page already exists",
|
||||||
"visualeditor-advancedsettings-tool": "Tool for opening the advanced settings section of the meta dialog.\n{{Identical|Advanced settings}}",
|
"visualeditor-advancedsettings-tool": "Tool for opening the advanced settings section of the meta dialog.\n{{Identical|Advanced settings}}",
|
||||||
"visualeditor-annotations-default-description": "Default description for annotated ranges",
|
"visualeditor-annotations-default-description": "Default description for annotated ranges",
|
||||||
"visualeditor-annotations-default-end": "Label of the context item for a closing annotation tag without message",
|
"visualeditor-annotations-default-end": "Label of the context item for a closing annotation tag without message",
|
||||||
|
|
|
@ -550,6 +550,8 @@ class Hooks implements TextSlotDiffRendererTablePrefixHook {
|
||||||
// us to splice into the middle of an associative array.
|
// us to splice into the middle of an associative array.
|
||||||
$newViews = [];
|
$newViews = [];
|
||||||
$wikiPageFactory = $services->getWikiPageFactory();
|
$wikiPageFactory = $services->getWikiPageFactory();
|
||||||
|
$isRemote = $title->inNamespace( NS_FILE ) &&
|
||||||
|
!$wikiPageFactory->newFromTitle( $title )->isLocal();
|
||||||
foreach ( $links['views'] as $action => $data ) {
|
foreach ( $links['views'] as $action => $data ) {
|
||||||
if ( $action === 'edit' ) {
|
if ( $action === 'edit' ) {
|
||||||
// Build the VisualEditor tab
|
// Build the VisualEditor tab
|
||||||
|
@ -567,32 +569,50 @@ class Hooks implements TextSlotDiffRendererTablePrefixHook {
|
||||||
// @phan-suppress-next-line PhanTypeInvalidDimOffset
|
// @phan-suppress-next-line PhanTypeInvalidDimOffset
|
||||||
$veTabText = $veTabMessage === null ? $data['text'] :
|
$veTabText = $veTabMessage === null ? $data['text'] :
|
||||||
$skin->msg( $veTabMessage )->text();
|
$skin->msg( $veTabMessage )->text();
|
||||||
|
if ( $isRemote ) {
|
||||||
|
// The following messages can be used here:
|
||||||
|
// * tooltip-ca-ve-edit-local
|
||||||
|
// * tooltip-ca-ve-create-local
|
||||||
|
$veTooltip = 'ca-ve-' . $action . '-local';
|
||||||
|
} else {
|
||||||
|
// The following messages can be used here:
|
||||||
|
// * tooltip-ca-ve-edit
|
||||||
|
// * tooltip-ca-ve-create
|
||||||
|
$veTooltip = 'ca-ve-' . $action;
|
||||||
|
}
|
||||||
$veTab = [
|
$veTab = [
|
||||||
'href' => $title->getLocalURL( $veParams ),
|
'href' => $title->getLocalURL( $veParams ),
|
||||||
'text' => $veTabText,
|
'text' => $veTabText,
|
||||||
|
'single-id' => $veTooltip,
|
||||||
'primary' => true,
|
'primary' => true,
|
||||||
'class' => '',
|
'class' => '',
|
||||||
];
|
];
|
||||||
|
|
||||||
// Alter the edit tab
|
// Alter the edit tab
|
||||||
$editTab = $data;
|
$editTab = $data;
|
||||||
if (
|
if ( $isRemote ) {
|
||||||
$title->inNamespace( NS_FILE ) &&
|
|
||||||
!$wikiPageFactory->newFromTitle( $title )->isLocal()
|
|
||||||
) {
|
|
||||||
// The following messages can be used here:
|
// The following messages can be used here:
|
||||||
// * visualeditor-ca-editlocaldescriptionsource
|
// * visualeditor-ca-editlocaldescriptionsource
|
||||||
// * visualeditor-ca-createlocaldescriptionsource
|
// * visualeditor-ca-createlocaldescriptionsource
|
||||||
$editTabMessage = $tabMessages[$action . 'localdescriptionsource'];
|
$editTabMessage = $tabMessages[$action . 'localdescriptionsource'];
|
||||||
|
// The following messages can be used here:
|
||||||
|
// * tooltip-ca-editsource-local
|
||||||
|
// * tooltip-ca-createsource-local
|
||||||
|
$editTabTooltip = 'ca-' . $action . 'source-local';
|
||||||
} else {
|
} else {
|
||||||
// The following messages can be used here:
|
// The following messages can be used here:
|
||||||
// * visualeditor-ca-editsource
|
// * visualeditor-ca-editsource
|
||||||
// * visualeditor-ca-createsource
|
// * visualeditor-ca-createsource
|
||||||
$editTabMessage = $tabMessages[$action . 'source'];
|
$editTabMessage = $tabMessages[$action . 'source'];
|
||||||
|
// The following messages can be used here:
|
||||||
|
// * tooltip-ca-editsource
|
||||||
|
// * tooltip-ca-createsource
|
||||||
|
$editTabTooltip = 'ca-' . $action . 'source';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $editTabMessage !== null ) {
|
if ( $editTabMessage !== null ) {
|
||||||
$editTab['text'] = $skin->msg( $editTabMessage )->text();
|
$editTab['text'] = $skin->msg( $editTabMessage )->text();
|
||||||
|
$editTab['single-id'] = $editTabTooltip;
|
||||||
}
|
}
|
||||||
|
|
||||||
$editor = self::getLastEditor( $user, $skin->getRequest() );
|
$editor = self::getLastEditor( $user, $skin->getRequest() );
|
||||||
|
|
|
@ -909,14 +909,15 @@
|
||||||
caVeEditNextnode =
|
caVeEditNextnode =
|
||||||
( conf.tabPosition === 'before' ) ?
|
( conf.tabPosition === 'before' ) ?
|
||||||
$caEdit.get( 0 ) :
|
$caEdit.get( 0 ) :
|
||||||
$caEdit.next().get( 0 );
|
$caEdit.next().get( 0 ),
|
||||||
|
isRemote = $( '#ca-view-foreign' ).length;
|
||||||
|
|
||||||
if ( !$caVeEdit.length ) {
|
if ( !$caVeEdit.length ) {
|
||||||
// The below duplicates the functionality of VisualEditorHooks::onSkinTemplateNavigation()
|
// The below duplicates the functionality of VisualEditorHooks::onSkinTemplateNavigation()
|
||||||
// in case we're running on a cached page that doesn't have these tabs yet.
|
// in case we're running on a cached page that doesn't have these tabs yet.
|
||||||
|
|
||||||
// Alter the edit tab (#ca-edit)
|
// Alter the edit tab (#ca-edit)
|
||||||
if ( $( '#ca-view-foreign' ).length ) {
|
if ( isRemote ) {
|
||||||
if ( tabMessages[ action + 'localdescriptionsource' ] ) {
|
if ( tabMessages[ action + 'localdescriptionsource' ] ) {
|
||||||
// The following messages can be used here:
|
// The following messages can be used here:
|
||||||
// * visualeditor-ca-editlocaldescriptionsource
|
// * visualeditor-ca-editlocaldescriptionsource
|
||||||
|
@ -931,6 +932,13 @@
|
||||||
$caEditLink.text( mw.msg( tabMessages[ action + 'source' ] ) );
|
$caEditLink.text( mw.msg( tabMessages[ action + 'source' ] ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// The following messages can be used here:
|
||||||
|
// * tooltip-ca-editsource
|
||||||
|
// * tooltip-ca-createsource
|
||||||
|
// * tooltip-ca-editsource-local
|
||||||
|
// * tooltip-ca-createsource-local
|
||||||
|
$caEditLink.attr( 'title', mw.msg( 'tooltip-ca-' + action + 'source' + ( isRemote ? '-local' : '' ) ) );
|
||||||
|
$caEditLink.updateTooltipAccessKeys();
|
||||||
|
|
||||||
// If there is no edit tab or a view-source tab,
|
// If there is no edit tab or a view-source tab,
|
||||||
// the user doesn't have permission to edit.
|
// the user doesn't have permission to edit.
|
||||||
|
@ -944,9 +952,14 @@
|
||||||
// 2) when onEditTabClick is not bound (!pageCanLoadEditor) it will
|
// 2) when onEditTabClick is not bound (!pageCanLoadEditor) it will
|
||||||
// just work.
|
// just work.
|
||||||
veEditUrl,
|
veEditUrl,
|
||||||
getTabMessage( action + ( $( '#ca-view-foreign' ).length ? '-local' : '' ) ),
|
getTabMessage( action + ( isRemote ? '-local' : '' ) ),
|
||||||
'ca-ve-edit',
|
'ca-ve-edit',
|
||||||
mw.msg( 'tooltip-ca-ve-edit' ),
|
// The following messages can be used here:
|
||||||
|
// * tooltip-ca-ve-edit
|
||||||
|
// * tooltip-ca-ve-create
|
||||||
|
// * tooltip-ca-ve-edit-local
|
||||||
|
// * tooltip-ca-ve-create-local
|
||||||
|
mw.msg( 'tooltip-ca-ve-' + action + ( isRemote ? '-local' : '' ) ),
|
||||||
mw.msg( 'accesskey-ca-ve-edit' ),
|
mw.msg( 'accesskey-ca-ve-edit' ),
|
||||||
caVeEditNextnode
|
caVeEditNextnode
|
||||||
);
|
);
|
||||||
|
@ -967,7 +980,14 @@
|
||||||
$caEdit.after( $caVeEdit );
|
$caEdit.after( $caVeEdit );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$caVeEditLink.text( getTabMessage( action + ( $( '#ca-view-foreign' ).length ? '-local' : '' ) ) );
|
$caVeEditLink.text( getTabMessage( action + ( isRemote ? '-local' : '' ) ) );
|
||||||
|
// The following messages can be used here:
|
||||||
|
// * tooltip-ca-ve-edit
|
||||||
|
// * tooltip-ca-ve-create
|
||||||
|
// * tooltip-ca-ve-edit-local
|
||||||
|
// * tooltip-ca-ve-create-local
|
||||||
|
$caVeEditLink.attr( 'title', mw.msg( 'tooltip-ca-ve-' + action + ( isRemote ? '-local' : '' ) ) );
|
||||||
|
$caVeEditLink.updateTooltipAccessKeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the edit tab is hidden, remove it.
|
// If the edit tab is hidden, remove it.
|
||||||
|
|
Loading…
Reference in a new issue