Skip to content

Commit

Permalink
modify: #450 options - rtl
Browse files Browse the repository at this point in the history
  • Loading branch information
JiHong88 committed Sep 21, 2020
1 parent f246292 commit afd54bc
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 23 deletions.
61 changes: 46 additions & 15 deletions src/assets/css/suneditor.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,6 @@
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
}
/* RTL - button */
.sun-editor.se-rtl button {
transform: rotate(0deg) rotateY(180deg);
}
.sun-editor.se-rtl * {
direction: rtl;
}

/** --- Icons ---------------------------------------------------------- */
/* default svg */
Expand Down Expand Up @@ -171,17 +164,15 @@
.sun-editor .se-menu-list {float:left; padding:0; margin:0;}
.sun-editor .se-menu-list li {position:relative; float:left; padding:0; margin:0;}
/* tool bar select button (font, fontSize, formatBlock) */
.sun-editor .se-btn-select {width:auto; display:flex; text-align:left; padding:4px 6px;}
.sun-editor .se-btn-select .txt {flex:auto; float:left; text-align:left;}
.sun-editor .se-btn-select {width:auto; display:flex; padding:4px 6px;}
.sun-editor .se-btn-select .txt {flex:auto; text-align:left;}
.sun-editor .se-btn-select.se-btn-tool-font {width:100px;}
.sun-editor .se-btn-select.se-btn-tool-format {width:80px;}
.sun-editor .se-btn-select.se-btn-tool-size {width:80px;}

/** --- menu tray -------------------------------------------------------------- */
.sun-editor .se-btn-tray {position:relative; width:100%; height:100%; margin:0; padding:0;}
.sun-editor .se-menu-tray {position:absolute; top:0px; left:0px; width:100%; height:0px;}
/* RTL - button tray */
.sun-editor.se-rtl .se-btn-tray {direction: rtl;}

/** --- submenu layer ---------------------------------------------------------- */
.sun-editor .se-submenu {overflow-x:hidden; overflow-y:auto;}
Expand Down Expand Up @@ -243,7 +234,7 @@
.sun-editor .se-list-layer .se-selector-color .se-color-pallet button:hover,
.sun-editor .se-list-layer .se-selector-color .se-color-pallet button:focus {border:3px solid #fff;}
/* submenu layer - form group (color selector) */
.sun-editor .se-submenu-form-group {display:flex; width:100%; height:auto; padding:4px;}
.sun-editor .se-submenu-form-group {display:flex; width:100%; min-height:40px; height:auto; padding:4px;}
.sun-editor .se-submenu-form-group input {flex:auto; display:inline-block; width:auto; height:33px; color:#555; font-size:12px; margin:1px 0 1px 0; padding:0; border-radius:0.25rem; border:1px solid #ccc;}
.sun-editor .se-submenu-form-group button {float:right; width:34px; height:34px; margin:0 2px !important;}
.sun-editor .se-submenu-form-group button.se-btn {border:1px solid #ccc;}
Expand Down Expand Up @@ -285,7 +276,7 @@
.sun-editor .se-dialog .se-dialog-inner .se-dialog-content .se-btn-primary {display:inline-block; padding:6px 12px; margin:0 0 10px 0 !important; font-size:14px; font-weight:normal; line-height:1.42857143; text-align:center; white-space:nowrap; vertical-align:middle; -ms-touch-action:manipulation; touch-action:manipulation; border-radius:4px;}
.sun-editor .se-dialog .se-dialog-inner .se-dialog-header {height:50px; padding:6px 15px 6px 15px; border-bottom:1px solid #e5e5e5;}
.sun-editor .se-dialog .se-dialog-inner .se-dialog-header .se-dialog-close {float:right; font-weight:bold; text-shadow:0 1px 0 #fff; -webkit-appearance:none; filter:alpha(opacity=100); opacity:1;}
.sun-editor .se-dialog .se-dialog-inner .se-dialog-header .se-modal-title {font-size:14px; font-weight:bold; margin:0; padding:0; line-height:2.5;}
.sun-editor .se-dialog .se-dialog-inner .se-dialog-header .se-modal-title {float:left; font-size:14px; font-weight:bold; margin:0; padding:0; line-height:2.5;}
.sun-editor .se-dialog .se-dialog-inner .se-dialog-body {position:relative; padding:15px;}
.sun-editor .se-dialog .se-dialog-inner .se-dialog-form {margin-bottom:10px;}
.sun-editor .se-dialog .se-dialog-inner .se-dialog-form-footer {margin-top:10px; margin-bottom:0;}
Expand All @@ -294,9 +285,9 @@
.sun-editor .se-dialog .se-dialog-inner .se-dialog-size-text .size-w {width:70px; text-align:center;}
.sun-editor .se-dialog .se-dialog-inner .se-dialog-size-text .size-h {width:70px; text-align:center;}
.sun-editor .se-dialog .se-dialog-inner .se-dialog-size-x {margin:0 8px 0 8px; width:25px; text-align:center;}
.sun-editor .se-dialog .se-dialog-inner .se-dialog-footer {padding:10px 15px 0px 15px; text-align:right; border-top:1px solid #e5e5e5;}
.sun-editor .se-dialog .se-dialog-inner .se-dialog-footer {height:55px; padding:10px 15px 0px 15px; text-align:right; border-top:1px solid #e5e5e5;}
.sun-editor .se-dialog .se-dialog-inner .se-dialog-footer > div {float:left;}
.sun-editor .se-dialog .se-dialog-inner .se-dialog-footer > div > label {margin-top:5px;}
.sun-editor .se-dialog .se-dialog-inner .se-dialog-footer > div > label {margin:0 5px 0 0;}
.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-radio {margin-left:12px; margin-right:6px;}
.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-check {margin-left:12px; margin-right:4px;}
.sun-editor .se-dialog .se-dialog-inner .se-dialog-form-footer .se-dialog-btn-check {margin-left:0; margin-right:4px;}
Expand Down Expand Up @@ -427,6 +418,46 @@
.sun-editor .se-tooltip .se-tooltip-inner .se-tooltip-text::after {content:""; position:absolute; bottom:100%; left:50%; margin-left:-5px; border-width:5px; border-style:solid; border-color:transparent transparent #333 transparent;}
.sun-editor .se-tooltip:hover .se-tooltip-inner {visibility:visible; opacity:1;}


/** --- RTL ---------------------------------------------------------- */
/* tray */
.sun-editor.se-rtl .se-btn-tray {direction:rtl;}
/* button - se-rtl-icon */
.sun-editor.se-rtl button.se-rtl-icon {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 */
.sun-editor .se-btn-list {text-align:right;}
/* button - se-menu-list - li */
.sun-editor .se-menu-list li {float:right;}
/* menu list */
.sun-editor .se-list-layer * {direction:rtl;}
/* menu list - format block */
.sun-editor .se-list-layer.se-list-format ul blockquote {padding:0 7px 0 0; border-right-width:5px; border-left-width:0;}
/* menu list - color picker */
.sun-editor .se-list-layer .se-selector-color .se-color-pallet li {float:right;}
/* placeholder */
.sun-editor.se-rtl .se-wrapper .se-placeholder {direction:rtl;}
/* dialog */
.sun-editor.se-rtl .se-dialog * {direction:rtl;}
/* dialog - header */
.sun-editor.se-rtl .se-dialog .se-dialog-inner .se-dialog-header .se-dialog-close {float:left;}
.sun-editor.se-rtl .se-dialog .se-dialog-inner .se-dialog-header .se-modal-title {float:right;}
/* dialog - tabs */
.sun-editor.se-rtl .se-dialog-tabs button {float:right;}
.sun-editor.se-rtl .se-dialog .se-dialog-inner .se-dialog-size-text {padding-right:34px;}
/* dialog - footer */
.sun-editor.se-rtl .se-dialog .se-dialog-inner .se-dialog-content .se-btn-primary {float:left}
.sun-editor.se-rtl .se-dialog .se-dialog-inner .se-dialog-footer > div {float:right;}
.sun-editor.se-rtl .se-dialog .se-dialog-inner .se-dialog-footer > div > label {margin:0 0 0 5px;}
/* fileBrowser */
.sun-editor .se-file-browser * {direction:rtl;}
/* fileBrowser - header */
.sun-editor .se-file-browser .se-file-browser-tags {text-align:right;}
.sun-editor .se-file-browser .se-file-browser-tags a {margin: 8px 8px 0 8px;}
.sun-editor.se-rtl .se-file-browser .se-file-browser-header .se-file-browser-close {float:left;}


/** animation */
@keyframes blinker { 50% {opacity:0;} }
@keyframes spinner { to {transform:rotate(361deg);} }
6 changes: 3 additions & 3 deletions src/lib/constructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -532,8 +532,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 + (shortcutsDisable.indexOf('indent') > -1 ? '' : ' (' + cmd + '+])'), 'indent', '', icons.outdent],
outdent: ['_se_command_outdent', lang.toolbar.outdent + (shortcutsDisable.indexOf('indent') > -1 ? '' : ' (' + cmd + '+[)'), 'outdent', '', icons.indent],
indent: ['_se_command_indent se-rtl-icon', lang.toolbar.indent + (shortcutsDisable.indexOf('indent') > -1 ? '' : ' (' + cmd + '+])'), 'indent', '', icons.outdent],
outdent: ['_se_command_outdent se-rtl-icon', lang.toolbar.outdent + (shortcutsDisable.indexOf('indent') > -1 ? '' : ' (' + cmd + '+[)'), '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 +551,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', icons.align_left],
list: ['', lang.toolbar.list, 'list', 'submenu', icons.list_number],
list: ['se-rtl-icon', 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
7 changes: 4 additions & 3 deletions src/lib/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -3929,6 +3929,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
const rangeLines = this.getSelectedElements(null);
const cells = [];
const shift = 'indent' !== command;
const marginDir = options.rtl ? 'marginRight' : 'marginLeft';
let sc = range.startContainer;
let ec = range.endContainer;
let so = range.startOffset;
Expand All @@ -3938,13 +3939,13 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
f = rangeLines[i];

if (!util.isListCell(f) || !this.plugins.list) {
margin = /\d+/.test(f.style.marginLeft) ? util.getNumber(f.style.marginLeft, 0) : 0;
margin = /\d+/.test(f.style[marginDir]) ? util.getNumber(f.style[marginDir], 0) : 0;
if (shift) {
margin -= 25;
} else {
margin += 25;
}
util.setStyle(f, 'marginLeft', (margin <= 0 ? '' : margin + 'px'));
util.setStyle(f, marginDir, (margin <= 0 ? '' : margin + 'px'));
} else {
if (shift || f.previousElementSibling) {
cells.push(f);
Expand Down Expand Up @@ -6276,7 +6277,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
},

onBlur_wysiwyg: function (e) {
if (core._antiBlur) return;
if (core._antiBlur || core._variable.isCodeView) return;
core.hasFocus = false;
core.controllersOff();
if (core._isInline || core._isBalloon) event._hideToolbar();
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 @@ -45,10 +45,10 @@ export default {
listDiv.innerHTML = '' +
'<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 + '">' +
'<li><button type="button" class="se-btn-list se-tooltip se-rtl-icon" data-command="OL" title="' + lang.toolbar.orderList + '">' +
this.icons.list_number +
'</button></li>' +
'<li><button type="button" class="se-btn-list se-tooltip" data-command="UL" title="' + lang.toolbar.unorderList + '">' +
'<li><button type="button" class="se-btn-list se-tooltip se-rtl-icon" data-command="UL" title="' + lang.toolbar.unorderList + '">' +
this.icons.list_bullets +
'</button></li>' +
'</ul>' +
Expand Down

0 comments on commit afd54bc

Please sign in to comment.