mirror of
https://github.com/ONLYOFFICE/web-apps.git
synced 2026-04-07 14:06:16 +08:00
[PDF] Bug 74417: add text direction
This commit is contained in:
@ -337,6 +337,8 @@ define([
|
||||
toolbar.btnLineSpace.menu.on('item:toggle', _.bind(this.onLineSpaceToggle, this));
|
||||
toolbar.btnColumns.menu.on('item:click', _.bind(this.onColumnsSelect, this));
|
||||
toolbar.btnColumns.menu.on('show:before', _.bind(this.onBeforeColumns, this));
|
||||
toolbar.btnTextDir.menu.on('item:click', _.bind(this.onTextDirClick, this));
|
||||
toolbar.btnTextDir.menu.on('show:after', _.bind(this.onTextDirShowAfter, this));
|
||||
toolbar.btnClearStyle.on('click', _.bind(this.onClearStyleClick, this));
|
||||
toolbar.btnShapeAlign.menu.on('item:click', _.bind(this.onShapeAlign, this));
|
||||
toolbar.btnShapeAlign.menu.on('show:before', _.bind(this.onBeforeShapeAlign, this));
|
||||
@ -430,6 +432,7 @@ define([
|
||||
this.api.asc_registerCallback('asc_onVerticalTextAlign', _.bind(this.onApiVerticalTextAlign, this));
|
||||
this.api.asc_registerCallback('asc_onTextColor', _.bind(this.onApiTextColor, this));
|
||||
this.api.asc_registerCallback('asc_onTextHighLight', _.bind(this.onApiTextHighlightColor, this));
|
||||
this.api.asc_registerCallback('asc_onTextDirection', _.bind(this.onApiTextDirection, this));
|
||||
// this.api.asc_registerCallback('asc_onCanGroup', _.bind(this.onApiCanGroup, this));
|
||||
// this.api.asc_registerCallback('asc_onCanUnGroup', _.bind(this.onApiCanUnGroup, this));
|
||||
},
|
||||
@ -2555,6 +2558,38 @@ define([
|
||||
this._setMarkerColor('transparent', 'menu');
|
||||
},
|
||||
|
||||
onTextDirClick: function(menu, item) {
|
||||
this.api && this.api.asc_setRtlTextDirection(!!item.value);
|
||||
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
|
||||
},
|
||||
|
||||
onTextDirShowAfter: function(menu, item) {
|
||||
Common.UI.TooltipManager.closeTip('rtlDirection');
|
||||
},
|
||||
|
||||
onApiTextDirection: function (isRtl){
|
||||
var toolbar = this.toolbar,
|
||||
oldRtl = toolbar.btnTextDir.options.dirRtl,
|
||||
newRtl = !!isRtl;
|
||||
if (oldRtl !== newRtl) {
|
||||
toolbar.btnTextDir.changeIcon({
|
||||
next: newRtl ? 'btn-rtl' : 'btn-ltr',
|
||||
curr: oldRtl ? 'btn-rtl' : 'btn-ltr'
|
||||
});
|
||||
toolbar.btnMarkers.changeIcon({
|
||||
next: newRtl ? 'btn-setmarkers-rtl' : 'btn-setmarkers',
|
||||
curr: oldRtl ? 'btn-setmarkers-rtl' : 'btn-setmarkers'
|
||||
});
|
||||
toolbar.btnNumbers.changeIcon({
|
||||
next: newRtl ? 'btn-numbering-rtl' : 'btn-numbering',
|
||||
curr: oldRtl ? 'btn-numbering-rtl' : 'btn-numbering'
|
||||
});
|
||||
toolbar.btnDecLeftOffset.cmpEl && toolbar.btnDecLeftOffset.cmpEl[newRtl ? 'addClass' : 'removeClass']('icon-mirrored')
|
||||
toolbar.btnIncLeftOffset.cmpEl && toolbar.btnIncLeftOffset.cmpEl[newRtl ? 'addClass' : 'removeClass']('icon-mirrored')
|
||||
toolbar.btnTextDir.options.dirRtl = !!isRtl;
|
||||
}
|
||||
},
|
||||
|
||||
changePDFMode: function(data) {
|
||||
this.toolbar && this.toolbar.btnEditMode && this.toolbar.btnEditMode.toggle(!!this.mode.isPDFEdit, true);
|
||||
},
|
||||
|
||||
@ -9,11 +9,11 @@
|
||||
<div class="padding-very-small"><label class="header"><%= scope.strIndent %></label></div>
|
||||
<div>
|
||||
<div class="padding-large margin-right-3" style="display: inline-block;">
|
||||
<label class="input-label"><%= scope.strIndentsLeftText %></label>
|
||||
<label id="paragraphadv-lbl-indent-left" class="input-label"><%= scope.strIndentsLeftText %></label>
|
||||
<div id="paragraphadv-spin-indent-left"></div>
|
||||
</div><!--
|
||||
--><div class="padding-large margin-right-3" style="display: inline-block;">
|
||||
<label class="input-label"><%= scope.strIndentsRightText %></label>
|
||||
<label id="paragraphadv-lbl-indent-right" class="input-label"><%= scope.strIndentsRightText %></label>
|
||||
<div id="paragraphadv-spin-indent-right"></div>
|
||||
</div><!--
|
||||
--><div class="padding-large" style="display: inline-block;vertical-align: top">
|
||||
@ -46,9 +46,13 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="padding-top: 16px;"><label class="header padding-very-small"><%= scope.strDirection %></label></div>
|
||||
<div>
|
||||
<div id="paragraphadv-dir-ltr" class="margin-right-20" style="display: inline-block;"></div><div id="paragraphadv-dir-rtl" class="margin-left-20" style="display: inline-block;"></div>
|
||||
</div>
|
||||
<div class="padding-large" style="padding-top: 16px; display: none;">
|
||||
<div style="border: 1px solid #cbcbcb; width: 350px;">
|
||||
<div id="paragraphadv-indent-preview" style="height: 80px; position: relative;"></div>
|
||||
<div id="paragraphadv-indent-preview" style="height: 58px; position: relative;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -124,6 +124,7 @@
|
||||
<span class="btn-slot split" id="slot-btn-valign"></span>
|
||||
<span class="btn-slot split" id="slot-btn-linespace"></span>
|
||||
<span class="btn-slot split" id="slot-btn-columns"></span>
|
||||
<span class="btn-slot split" id="slot-btn-direction"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="separator long pdfedit"></div>
|
||||
|
||||
@ -171,6 +171,9 @@ define([
|
||||
}, this));
|
||||
this.spinners.push(this.numIndentsRight);
|
||||
|
||||
this.lblIndentsLeft = $('#paragraphadv-lbl-indent-left');
|
||||
this.lblIndentsRight = $('#paragraphadv-lbl-indent-right');
|
||||
|
||||
this.cmbSpecial = new Common.UI.ComboBox({
|
||||
el: $('#paragraphadv-spin-special'),
|
||||
cls: 'input-group-nr',
|
||||
@ -262,6 +265,22 @@ define([
|
||||
this.spinners.push(this.numLineHeight);
|
||||
this.numLineHeight.on('change', _.bind(this.onNumLineHeightChange, this));
|
||||
|
||||
this.rbDirLtr = new Common.UI.RadioBox({
|
||||
el: $('#paragraphadv-dir-ltr'),
|
||||
name : 'text-dir',
|
||||
labelText : this.textDirLtr,
|
||||
value: false
|
||||
});
|
||||
this.rbDirLtr.on('change', _.bind(this.onTextDirChange, this));
|
||||
|
||||
this.rbDirRtl = new Common.UI.RadioBox({
|
||||
el: $('#paragraphadv-dir-rtl'),
|
||||
name : 'text-dir',
|
||||
labelText : this.textDirRtl,
|
||||
value: true
|
||||
});
|
||||
this.rbDirRtl.on('change', _.bind(this.onTextDirChange, this));
|
||||
|
||||
// Font
|
||||
|
||||
this.chStrike = new Common.UI.CheckBox({
|
||||
@ -408,7 +427,7 @@ define([
|
||||
getFocusedComponents: function() {
|
||||
return this.btnsCategory.concat([
|
||||
this.cmbTextAlignment, this.numIndentsLeft, this.numIndentsRight, this.cmbSpecial, this.numSpecialBy,
|
||||
this.numSpacingBefore, this.numSpacingAfter, this.cmbLineRule, this.numLineHeight, // 0 tab
|
||||
this.numSpacingBefore, this.numSpacingAfter, this.cmbLineRule, this.numLineHeight, this.rbDirLtr, this.rbDirRtl,// 0 tab
|
||||
this.chStrike, this.chSubscript, this.chDoubleStrike, this.chSmallCaps, this.chSuperscript, this.chAllCaps, this.numSpacing, // 1 tab
|
||||
this.numDefaultTab, this.numTab, this.cmbAlign, this.tabList, this.btnAddTab, this.btnRemoveTab, this.btnRemoveAll // 2 tab
|
||||
]).concat(this.getFooterButtons());
|
||||
@ -486,6 +505,14 @@ define([
|
||||
this.numLineHeight.setValue('', true);
|
||||
}
|
||||
|
||||
value = props.asc_getRtlDirection();
|
||||
if (value !== undefined) {
|
||||
this.rbDirRtl.setValue(value, true);
|
||||
this.rbDirLtr.setValue(!value, true);
|
||||
}
|
||||
this.lblIndentsLeft.text(value ? this.strIndentsSpacingBefore : this.strIndentsLeftText);
|
||||
this.lblIndentsRight.text(value ? this.strIndentsSpacingAfter : this.strIndentsRightText);
|
||||
|
||||
// Font
|
||||
this._noApply = true;
|
||||
this.chStrike.setValue((props.get_Strikeout() !== null && props.get_Strikeout() !== undefined) ? props.get_Strikeout() : 'indeterminate', true);
|
||||
@ -811,6 +838,14 @@ define([
|
||||
this.Spacing.put_Line((this.cmbLineRule.getValue()==c_paragraphLinerule.LINERULE_AUTO) ? field.getNumberValue() : Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()));
|
||||
},
|
||||
|
||||
onTextDirChange: function(field, newValue, eOpts) {
|
||||
if (newValue && this._changedProps) {
|
||||
this._changedProps.asc_putRtlDirection(field.options.value);
|
||||
this.lblIndentsLeft.text(field.options.value ? this.strIndentsSpacingBefore : this.strIndentsLeftText);
|
||||
this.lblIndentsRight.text(field.options.value ? this.strIndentsSpacingAfter : this.strIndentsRightText);
|
||||
}
|
||||
},
|
||||
|
||||
textTitle: 'Paragraph - Advanced Settings',
|
||||
strIndentsLeftText: 'Left',
|
||||
strIndentsRightText: 'Right',
|
||||
|
||||
@ -622,6 +622,26 @@ define([
|
||||
this.paragraphControls.push(this.btnColumns);
|
||||
arr.push(this.btnColumns);
|
||||
|
||||
this.btnTextDir = new Common.UI.Button({
|
||||
id: 'id-toolbar-btn-direction',
|
||||
cls: 'btn-toolbar',
|
||||
iconCls: 'toolbar__icon btn-ltr',
|
||||
action: 'text-direction',
|
||||
dirRtl: false,
|
||||
lock: [_set.paragraphLock, _set.lostConnect, _set.noParagraphSelected, _set.disableOnStart, _set.inAnnotation],
|
||||
menu: new Common.UI.Menu({
|
||||
items: [
|
||||
{caption: this.textDirLtr, value: false, iconCls: 'menu__icon btn-ltr'},
|
||||
{caption: this.textDirRtl, value: true, iconCls: 'menu__icon btn-rtl'},
|
||||
]
|
||||
}),
|
||||
dataHint: '1',
|
||||
dataHintDirection: 'bottom',
|
||||
dataHintOffset: '0, -6'
|
||||
});
|
||||
this.paragraphControls.push(this.btnTextDir);
|
||||
arr.push(this.btnTextDir);
|
||||
|
||||
this.mniAlignToSlide = new Common.UI.MenuItem({
|
||||
caption: this.txtPageAlign,
|
||||
checkable: true,
|
||||
@ -1410,6 +1430,7 @@ define([
|
||||
_injectComponent('#slot-btn-valign', this.btnVerticalAlign);
|
||||
_injectComponent('#slot-btn-linespace', this.btnLineSpace);
|
||||
_injectComponent('#slot-btn-columns', this.btnColumns);
|
||||
_injectComponent('#slot-btn-direction', this.btnTextDir);
|
||||
_injectComponent('#slot-btn-arrange-shape', this.btnShapeArrange);
|
||||
_injectComponent('#slot-btn-align-shape', this.btnShapeAlign);
|
||||
_injectComponent('#slot-btn-rotate', this.btnRotatePage);
|
||||
@ -1675,6 +1696,7 @@ define([
|
||||
this.btnIncLeftOffset.updateHint(this.tipIncPrLeft);
|
||||
this.btnLineSpace.updateHint(this.tipLineSpace);
|
||||
this.btnColumns.updateHint(this.tipColumns);
|
||||
this.btnTextDir.updateHint(this.tipTextDir);
|
||||
this.btnShapeAlign.updateHint(this.tipShapeAlign);
|
||||
this.btnShapeArrange.updateHint(this.tipShapeArrange);
|
||||
this.btnShapesMerge.updateHint(this.tipShapeMerge);
|
||||
|
||||
@ -1760,6 +1760,9 @@
|
||||
"PDFE.Views.ParagraphSettingsAdvanced.textTabRight": "Right",
|
||||
"PDFE.Views.ParagraphSettingsAdvanced.textTitle": "Paragraph - Advanced settings",
|
||||
"PDFE.Views.ParagraphSettingsAdvanced.txtAutoText": "Auto",
|
||||
"PDFE.Views.ParagraphSettingsAdvanced.textDirLtr": "Left-to-right",
|
||||
"PDFE.Views.ParagraphSettingsAdvanced.textDirRtl": "Right-to-left",
|
||||
"PDFE.Views.ParagraphSettingsAdvanced.strDirection": "Direction",
|
||||
"PDFE.Views.PrintWithPreview.textMarginsLast": "Last custom",
|
||||
"PDFE.Views.PrintWithPreview.textMarginsModerate": "Moderate",
|
||||
"PDFE.Views.PrintWithPreview.textMarginsNarrow": "Narrow",
|
||||
@ -2209,6 +2212,9 @@
|
||||
"PDFE.Views.Toolbar.txtRotatePageRight": "Rotate page right",
|
||||
"PDFE.Views.Toolbar.txtRotateRight": "Rotate right",
|
||||
"PDFE.Views.Toolbar.txtUngroup": "Ungroup",
|
||||
"PDFE.Views.Toolbar.tipTextDir": "Text direction",
|
||||
"PDFE.Views.Toolbar.textDirLtr": "Left-to-right",
|
||||
"PDFE.Views.Toolbar.textDirRtl": "Right-to-left",
|
||||
"PDFE.Views.ViewTab.textAlwaysShowToolbar": "Always Show Toolbar",
|
||||
"PDFE.Views.ViewTab.textDarkDocument": "Dark Document",
|
||||
"PDFE.Views.ViewTab.textFill": "Fill",
|
||||
|
||||
@ -46,11 +46,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="padding-large" style="padding-top: 16px; display: none;">
|
||||
<div style="border: 1px solid #cbcbcb; width: 350px;">
|
||||
<div id="paragraphadv-indent-preview" style="height: 80px; position: relative;"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="padding-top: 16px;"><label class="header padding-very-small"><%= scope.strDirection %></label></div>
|
||||
<div>
|
||||
<div id="paragraphadv-dir-ltr" class="margin-right-20" style="display: inline-block;"></div><div id="paragraphadv-dir-rtl" class="margin-left-20" style="display: inline-block;"></div>
|
||||
|
||||
Reference in New Issue
Block a user