-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add support for svg icons #74
Conversation
"rtr": "indent-more" | ||
}, | ||
"redo": { | ||
"ltr": "redo", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure these are directional? It kinda makes sense... but I'd love to get some reading about it :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CKEditor have it as directional (automatically uses .cke-ltr
or .cke-rtl
classes`). I assumed it was correct.
"find": "search", | ||
"find": { | ||
"ltr": "search", | ||
"rtl": "search" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this mean to be a different search
? Or if they're the same, why separate rtl
and ltr
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same, CKEditor have it as directional so we need to specify the icon for both directions. Probably we'll need to specify other icon, something like search-rtl
"anchor": "flag-full", | ||
"anchor": { | ||
"ltr": "flag-full" | ||
}, | ||
"blockquote": "quote-right", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this one be directional as well? :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is but we don't have the rtl icon yet. I can use the same until we have it or just leave it blank.
skins/moono-lexicon/icons/icons.json
Outdated
@@ -4,36 +4,59 @@ | |||
"align-image-center": "align-image-center", | |||
"align-image-left": "align-image-left", | |||
"align-image-right": "align-image-right", | |||
"anchor": "flag-full", | |||
"anchor": { | |||
"ltr": "flag-full" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here... why just ltr
?
I just have no idea what this is supposed to do, it just feels weird :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as the others
support/iconsClassesGenerator.js
Outdated
}`; | ||
|
||
iconsCSSContent += `${activeIconCSS} ${defaultIconCSS} ${disableIconCSS} ${hoverIconCSS} ${focusIconCSS}`; | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we still saving all these comments? :D
Not sure if this is something you want to keep... but if you do, one option is to create a bogus commit adding it and one removing it, so you will have it in the git history :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ups, no, I have it already in the history, just forgot to remove it, thx
ck.sh
Outdated
@@ -59,7 +59,7 @@ case "$COMMAND" in | |||
cd ckeditor-dev | |||
|
|||
# Convert svg icons to png |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this comment is no longer acurate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upsy
About CKEditor automatically adds to the css the classes for all the icons in There are some of those
Anyway, not an expert, maybe @drakonux can provide more info :) |
Forgot to mention that even if we don't want to mirror some of those icons we need to specify the |
LGTM, @carloslancha! Just one question... could you highlight which of the icons in the gif are ours and which ones are ckeditor's? |
@jbalsas updated description |
support/iconsClassesGenerator.js
Outdated
const activeIconCSS = `${directionClass}.cke_hidpi .cke_button.cke_button_on .cke_button__${cKEditorIcon}_icon, | ||
${directionClass} .cke_button.cke_button_on .cke_button__${cKEditorIcon}_icon { | ||
background: url("data:image/svg+xml;charset=utf8,${encodeSvgData( | ||
svgData, | ||
activeColor | ||
)}") !important; | ||
}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I'd format these so that the output is consistently indented:
const activeIconCSS = `
${directionClass}.cke_hidpi .cke_button.cke_button_on .cke_button__${cKEditorIcon}_icon,
${directionClass} .cke_button.cke_button_on .cke_button__${cKEditorIcon}_icon {
background: url("data:image/svg+xml;charset=utf8,${encodeSvgData(
svgData,
activeColor
)}") !important;
}
`;
(The way you have it, you have 0 indent on first line, then it jumps to two tabs of indent)
support/iconsClassesGenerator.js
Outdated
)}") !important; | ||
}`; | ||
|
||
return `${activeIconCSS} ${defaultIconCSS} ${disableIconCSS} ${hoverIconCSS} ${focusIconCSS}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe?
return [
activeIconCSS,
defaultIconCSS,
disableIconCSS,
hoverIconCSS,
focusIconCSS,
].join('\n\n');
support/iconsClassesGenerator.js
Outdated
.replace(/(<svg[^>]*)( fill="[^"]+")/, '\1') | ||
.replace(/<svg/, `<svg fill="${color}"`) | ||
.replace(/"/g, "'") // Use single quotes instead of double to avoid encoding. | ||
.replace(/>\s{1,}</g, '><') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{1,}
is just +
, isn't it? Why not use that?
ck.sh
Outdated
@@ -58,8 +58,8 @@ case "$COMMAND" in | |||
|
|||
cd ckeditor-dev | |||
|
|||
# Convert svg icons to png | |||
node ../support/svgToPng.js skins/moono-lexicon/icons/icons.json skins/moono-lexicon/icons | |||
# Generate svg icons CSS Classes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Consistent capitalization? (ie. "svg" vs "CSS")
@wincent formated |
https://issues.liferay.com/browse/IFI-1829
We need to use SVG icons as we discussed on slack
In this pr we're generating needed icon classes for all the different states and adding required support for
rtl
andltr
.Striked out ckeditor icons: