Skip to content

Commit

Permalink
update: #450 rtl icons
Browse files Browse the repository at this point in the history
  • Loading branch information
JiHong88 committed Oct 5, 2020
1 parent 410ef7f commit f0f6a45
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 7 deletions.
2 changes: 0 additions & 2 deletions src/assets/css/suneditor.css
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,6 @@
/** --- RTL ---------------------------------------------------------- */
/* tray */
.sun-editor.se-rtl .se-btn-tray {direction:rtl;}
/* button - se-rtl-icon */
.sun-editor.se-rtl button .se-rtl-icon {display:initial; transform:rotate(0deg) rotateY(180deg);}
/* button - select text */
.sun-editor.se-rtl .se-btn-select .txt {flex:auto; text-align:right; direction:rtl;}
/* button - se-menu-list */
Expand Down
12 changes: 12 additions & 0 deletions src/assets/defaultIcons.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 11 additions & 3 deletions src/lib/constructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -501,12 +501,20 @@ export default {
];

/** --- Define icons --- */
// custom icons
options.icons = (!options.icons || typeof options.icons !== 'object') ? _icons : [_icons, options.icons].reduce(function (_default, _new) {
for (let key in _new) {
if (util.hasOwn(_new, key)) _default[key] = _new[key];
}
return _default;
}, {});
// rtl icons
options.icons = !options.rtl ? options.icons : [options.icons, options.icons.rtl].reduce(function (_default, _new) {
for (let key in _new) {
if (util.hasOwn(_new, key)) _default[key] = _new[key];
}
return _default;
}, {});

/** _init options */
options._editorStyles = util._setDefaultOptionStyle(options, options.defaultStyle);
Expand All @@ -532,8 +540,8 @@ export default {
subscript: ['_se_command_subscript', lang.toolbar.subscript, 'SUB', '', icons.subscript],
superscript: ['_se_command_superscript', lang.toolbar.superscript, 'SUP', '', icons.superscript],
removeFormat: ['', lang.toolbar.removeFormat, 'removeFormat', '', icons.erase],
indent: ['_se_command_indent', lang.toolbar.indent + '<span class="se-shortcut">' + (shortcutsDisable.indexOf('indent') > -1 ? '' : ' (' + cmd + '+])') + '</span>', 'indent', '', '<span class="se-rtl-icon">' + icons.outdent + '</span>'],
outdent: ['_se_command_outdent', lang.toolbar.outdent + '<span class="se-shortcut">' + (shortcutsDisable.indexOf('indent') > -1 ? '' : ' (' + cmd + '+[)') + '</span>', 'outdent', '', '<span class="se-rtl-icon">' + icons.indent + '</span>'],
indent: ['_se_command_indent', lang.toolbar.indent + '<span class="se-shortcut">' + (shortcutsDisable.indexOf('indent') > -1 ? '' : ' (' + cmd + '+])') + '</span>', 'indent', '', icons.outdent],
outdent: ['_se_command_outdent', lang.toolbar.outdent + '<span class="se-shortcut">' + (shortcutsDisable.indexOf('indent') > -1 ? '' : ' (' + cmd + '+[)') + '</span>', 'outdent', '', icons.indent],
fullScreen: ['se-code-view-enabled se-resizing-enabled _se_command_fullScreen', lang.toolbar.fullScreen, 'fullScreen', '', icons.expansion],
showBlocks: ['_se_command_showBlocks', lang.toolbar.showBlocks, 'showBlocks', '', icons.show_blocks],
codeView: ['se-code-view-enabled se-resizing-enabled _se_command_codeView', lang.toolbar.codeView, 'codeView', '', icons.code_view],
Expand All @@ -551,7 +559,7 @@ export default {
fontColor: ['', lang.toolbar.fontColor, 'fontColor', 'submenu', icons.font_color],
hiliteColor: ['', lang.toolbar.hiliteColor, 'hiliteColor', 'submenu', icons.highlight_color],
align: ['se-btn-align', lang.toolbar.align, 'align', 'submenu', (options.rtl ? icons.align_right : icons.align_left)],
list: ['', lang.toolbar.list, 'list', 'submenu', '<span class="se-rtl-icon">' + icons.list_number + '</span>'],
list: ['', lang.toolbar.list, 'list', 'submenu', icons.list_number],
horizontalRule: ['btn_line', lang.toolbar.horizontalRule, 'horizontalRule', 'submenu', icons.horizontal_rule],
table: ['', lang.toolbar.table, 'table', 'submenu', icons.table],
lineHeight: ['', lang.toolbar.lineHeight, 'lineHeight', 'submenu', icons.line_height],
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/submenu/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ export default {
'<div class="se-list-inner">' +
'<ul class="se-list-basic">' +
'<li><button type="button" class="se-btn-list se-tooltip" data-command="OL" title="' + lang.toolbar.orderList + '">' +
'<span class="se-rtl-icon">' + this.icons.list_number + '</span>' +
this.icons.list_number +
'</button></li>' +
'<li><button type="button" class="se-btn-list se-tooltip" data-command="UL" title="' + lang.toolbar.unorderList + '">' +
'<span class="se-rtl-icon">' + this.icons.list_bullets + '</span>' +
this.icons.list_bullets +
'</button></li>' +
'</ul>' +
'</div>';
Expand Down

0 comments on commit f0f6a45

Please sign in to comment.