Use resource loader for icons

Change-Id: I6614d2b33936e4e4f04412b76df67dc5554bf3f7
This commit is contained in:
Ed Sanders 2018-04-11 17:56:19 +01:00
parent bfa7799761
commit b8a9115d27
2 changed files with 52 additions and 117 deletions

View file

@ -120,6 +120,57 @@ class CiteHooks {
$resourceLoader->register( "ext.cite.visualEditor.data",
[ "class" => "CiteDataModule" ] );
$resourceLoader->register( "ext.cite.visualEditor.icons", [
'localBasePath' => $dir . 'modules',
'remoteExtPath' => 'Cite/modules',
"class" => "ResourceLoaderImageModule",
"selectorWithoutVariant" => ".oo-ui-icon-{name}",
"selectorWithVariant" => ".oo-ui-image-{variant}.oo-ui-icon-{name}",
"variants" => [
"progressive" => [
"color" => "#36c"
]
],
"images" => [
"ref-cite-book" => [
"file" => "ve-cite/icons/ref-cite-book.svg"
],
"ref-cite-journal" => [
"file" => [
"ltr" => "ve-cite/icons/ref-cite-journal-ltr.svg",
"rtl" => "ve-cite/icons/ref-cite-journal-rtl.svg"
]
],
"ref-cite-news" => [
"file" => [
"ltr" => "ve-cite/icons/ref-cite-news-ltr.svg",
"rtl" => "ve-cite/icons/ref-cite-news-rtl.svg"
]
],
"ref-cite-web" => [
"file" => "ve-cite/icons/ref-cite-web.svg"
],
"reference" => [
"file" => [
"ltr" => "ve-cite/icons/reference-ltr.svg",
"rtl" => "ve-cite/icons/reference-rtl.svg"
]
],
"reference-existing" => [
"file" => [
"ltr" => "ve-cite/icons/reference-existing-ltr.svg",
"rtl" => "ve-cite/icons/reference-existing-rtl.svg"
]
],
"references" => [
"file" => [
"ltr" => "ve-cite/icons/references-ltr.svg",
"rtl" => "ve-cite/icons/references-rtl.svg"
]
],
]
] );
$resourceLoader->register( "ext.cite.visualEditor", [
'localBasePath' => $dir . 'modules',
'remoteExtPath' => 'Cite/modules',
@ -142,7 +193,6 @@ class CiteHooks {
"styles" => [
"ve-cite/ve.ui.MWReferenceContextItem.css",
"ve-cite/ve.ui.MWReferenceGroupInputWidget.css",
"ve-cite/ve.ui.MWReferenceIcons.css",
"ve-cite/ve.ui.MWReferenceResultWidget.css",
"ve-cite/ve.ui.MWReferenceSearchWidget.css"
],
@ -151,6 +201,7 @@ class CiteHooks {
"oojs-ui.styles.icons-interactions",
"ext.cite.visualEditor.core",
"ext.cite.visualEditor.data",
"ext.cite.visualEditor.icons",
"ext.cite.style",
"ext.cite.styles",
"ext.visualEditor.mwtransclusion",

View file

@ -1,116 +0,0 @@
/*!
* Cite VisualEditor UserInterface icon styles.
*
* @copyright 2011-2018 VisualEditor Team's Cite sub-team and others; see AUTHORS.txt
* @license MIT
*/
/* @noflip */
.ve-ui-dir-block-rtl .oo-ui-icon-reference,
/* HACK */
.ve-ui-surface-dir-rtl .oo-ui-icon-reference,
/* HACK */
.oo-ui-rtl .oo-ui-icon-reference {
/* @embed */
background-image: url( icons/reference-rtl.svg );
}
/* @noflip */
.ve-ui-dir-block-ltr .oo-ui-icon-reference,
/* HACK */
.ve-ui-surface-dir-ltr .oo-ui-icon-reference,
/* HACK */
.oo-ui-ltr .oo-ui-icon-reference {
/* @embed */
background-image: url( icons/reference-ltr.svg );
}
/* @noflip */
.ve-ui-dir-block-rtl .oo-ui-icon-reference-existing,
/* HACK */
.ve-ui-surface-dir-rtl .oo-ui-icon-reference-existing,
/* HACK */
.oo-ui-rtl .oo-ui-icon-reference-existing {
/* @embed */
background-image: url( icons/reference-existing-rtl.svg );
}
/* @noflip */
.ve-ui-dir-block-ltr .oo-ui-icon-reference-existing,
/* HACK */
.ve-ui-surface-dir-ltr .oo-ui-icon-reference-existing,
/* HACK */
.oo-ui-ltr .oo-ui-icon-reference-existing {
/* @embed */
background-image: url( icons/reference-existing-ltr.svg );
}
/* @noflip */
.ve-ui-dir-block-rtl .oo-ui-icon-references,
/* HACK */
.ve-ui-surface-dir-rtl .oo-ui-icon-references,
/* HACK */
.oo-ui-rtl .oo-ui-icon-references {
/* @embed */
background-image: url( icons/references-rtl.svg );
}
/* @noflip */
.ve-ui-dir-block-ltr .oo-ui-icon-references,
/* HACK */
.ve-ui-surface-dir-ltr .oo-ui-icon-references,
/* HACK */
.oo-ui-ltr .oo-ui-icon-references {
/* @embed */
background-image: url( icons/references-ltr.svg );
}
.oo-ui-icon-ref-cite-book {
/* @embed */
background-image: url( icons/ref-cite-book.svg );
}
/* @noflip */
.ve-ui-dir-block-rtl .oo-ui-icon-ref-cite-journal,
/* HACK */
.ve-ui-surface-dir-rtl .oo-ui-icon-ref-cite-journal,
/* HACK */
.oo-ui-rtl .oo-ui-icon-ref-cite-journal {
/* @embed */
background-image: url( icons/ref-cite-journal-rtl.svg );
}
/* @noflip */
.ve-ui-dir-block-ltr .oo-ui-icon-ref-cite-journal,
/* HACK */
.ve-ui-surface-dir-ltr .oo-ui-icon-ref-cite-journal,
/* HACK */
.oo-ui-ltr .oo-ui-icon-ref-cite-journal {
/* @embed */
background-image: url( icons/ref-cite-journal-ltr.svg );
}
/* @noflip */
.ve-ui-dir-block-rtl .oo-ui-icon-ref-cite-news,
/* HACK */
.ve-ui-surface-dir-rtl .oo-ui-icon-ref-cite-news,
/* HACK */
.oo-ui-rtl .oo-ui-icon-ref-cite-news {
/* @embed */
background-image: url( icons/ref-cite-news-rtl.svg );
}
/* @noflip */
.ve-ui-dir-block-ltr .oo-ui-icon-ref-cite-news,
/* HACK */
.ve-ui-surface-dir-ltr .oo-ui-icon-ref-cite-news,
/* HACK */
.oo-ui-ltr .oo-ui-icon-ref-cite-news {
/* @embed */
background-image: url( icons/ref-cite-news-ltr.svg );
}
.oo-ui-icon-ref-cite-web {
/* @embed */
background-image: url( icons/ref-cite-web.svg );
}