Skip to content

Commit

Permalink
Merge pull request 'feature/pdf-change-annot' (#170) from feature/pdf…
Browse files Browse the repository at this point in the history
…-change-annot into release/v8.3.0
  • Loading branch information
Julia Radzhabova committed Dec 11, 2024
2 parents ae42027 + f459a9a commit c973ced
Show file tree
Hide file tree
Showing 54 changed files with 2,989 additions and 2,635 deletions.
14 changes: 8 additions & 6 deletions apps/common/main/lib/component/ColorButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,15 @@ define([
render: function(parentEl) {
Common.UI.Button.prototype.render.call(this, parentEl);

if (/huge/.test(this.options.cls) && this.options.split === true && !this.options.hideColorLine) {
// options.colorLine: true/false/'line'/'box'
var colorLineCls = this.options.colorLine==='box' ? 'btn-color-value-box' : 'btn-color-value-line';
if (/huge/.test(this.options.cls) && this.options.split === true && (this.options.colorLine!==false)) {
var btnEl = $('button', this.cmpEl),
btnMenuEl = $(btnEl[1]);
btnMenuEl && btnMenuEl.append( $('<div class="btn-color-value-line"></div>'));
} else if (!this.options.hideColorLine)
$('button:first-child', this.cmpEl).append( $('<div class="btn-color-value-line"></div>'));
this.colorEl = this.cmpEl.find('.btn-color-value-line');
btnMenuEl && btnMenuEl.append( $('<div class="' + colorLineCls + '"></div>'));
} else if ((this.options.colorLine!==false))
$('button:first-child', this.cmpEl).append( $('<div class="' + colorLineCls + '"></div>'));
this.colorEl = this.cmpEl.find('.' + colorLineCls);

if (this.options.auto)
this.autocolor = (typeof this.options.auto == 'object') ? this.options.auto.color || '000000' : '000000';
Expand Down Expand Up @@ -178,7 +180,7 @@ define([

if (this.colorEl) {
this.colorEl.css({'background-color': (color=='transparent') ? color : ((typeof(color) == 'object') ? '#'+color.color : '#'+color)});
this.colorEl.toggleClass('bordered', color=='transparent');
this.colorEl.toggleClass('bordered', color=='transparent' || this.options.colorLine==='box');
}
},

Expand Down
23 changes: 23 additions & 0 deletions apps/common/main/resources/less/buttons.less
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,29 @@
top: 4px;
}
}
.btn-color-value-box {
pointer-events: none;
position: absolute;
left: 3px;
bottom: 3px;
width: 14px;
height: 14px;
background-color: red;
.rtl & {
left: auto;
right: 3px;
}
&.bordered {
border: @scaled-one-px-value-ie solid @border-color-shading-ie;
border: @scaled-one-px-value solid @border-color-shading;
}
}

&.no-icon {
.icon {
visibility: hidden;
}
}

&.no-caret {
.inner-box-caret {
Expand Down
2 changes: 1 addition & 1 deletion apps/documenteditor/main/app/view/Toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -1628,7 +1628,7 @@ define([
caption: me.capBtnPageColor,
menu: true,
eyeDropper: false,
hideColorLine: true,
colorLine: false,
additionalItemsBefore: [
me.mnuPageNoFill = new Common.UI.MenuItem({
caption: me.strMenuNoFill,
Expand Down
2,345 changes: 26 additions & 2,319 deletions apps/pdfeditor/main/app/controller/DocumentHolder.js

Large diffs are not rendered by default.

2,495 changes: 2,495 additions & 0 deletions apps/pdfeditor/main/app/controller/DocumentHolderExt.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions apps/pdfeditor/main/app/controller/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,8 @@ define([
Common.Utils.InternalSettings.set("pdfe-settings-show-alt-hints", value);
value = Common.localStorage.getBool("pdfe-settings-annot-bar", true);
Common.Utils.InternalSettings.set("pdfe-settings-annot-bar", value);
value = Common.localStorage.getBool("pdfe-settings-annot-sel-bar", true);
Common.Utils.InternalSettings.set("pdfe-settings-annot-sel-bar", value);

/** coauthoring begin **/
me.onPdfModeCoAuthApply();
Expand Down
264 changes: 2 additions & 262 deletions apps/pdfeditor/main/app/view/DocumentHolder.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,269 +147,9 @@ define([
});
},

createTextBar: function(textBarBtns) {
var container = $('<div id="text-bar-container" style="position: absolute;">' +
'<div id="text-bar-fonts" style="display:inline-block;" class="margin-right-2"></div>' +
'<div id="text-bar-font-size" style="display:inline-block;" class="margin-right-4"></div>' +
'<div id="text-bar-bold" style="display:inline-block;" class="margin-right-4"></div>' +
'<div id="text-bar-italic" style="display:inline-block;" class="margin-right-4"></div>' +
'<div id="text-bar-underline" style="display:inline-block;" class="margin-right-4"></div>' +
'<div id="text-bar-strikeout" style="display:inline-block;" class="margin-right-4"></div>' +
'<div id="text-bar-super" style="display:inline-block;" class="margin-right-4"></div>' +
'<div id="text-bar-sub" style="display:inline-block;" class="margin-right-4"></div>' +
'<div id="text-bar-textcolor" style="display:inline-block;"></div>' +
'</div>'),
toolbarController = PDFE.getController('Toolbar'),
toolbar = toolbarController.getView('Toolbar');
createTextBar: function(textBarBtns) {},

this.cmbFontName = new Common.UI.ComboBoxFonts({
el: $('#text-bar-fonts', container),
cls : 'input-group-nr',
style : 'width: 100px;',
menuCls : 'scrollable-menu menu-absolute',
menuStyle : 'min-width: 100%;max-height: 270px;',
restoreMenuHeightAndTop: 220,
store : new Common.Collections.Fonts(),
hint : toolbar.tipFontName
});
textBarBtns.push(this.cmbFontName);
toolbarController.fillFontsStore(this.cmbFontName);

this.cmbFontSize = new Common.UI.ComboBox({
el: $('#text-bar-font-size', container),
cls: 'input-group-nr',
style: 'width: 45px;',
menuCls : 'scrollable-menu menu-absolute',
menuStyle: 'min-width: 45px;max-height: 270px;',
restoreMenuHeightAndTop: 220,
hint: toolbar.tipFontSize,
data: [
{value: 8, displayValue: "8"},
{value: 9, displayValue: "9"},
{value: 10, displayValue: "10"},
{value: 11, displayValue: "11"},
{value: 12, displayValue: "12"},
{value: 14, displayValue: "14"},
{value: 16, displayValue: "16"},
{value: 18, displayValue: "18"},
{value: 20, displayValue: "20"},
{value: 22, displayValue: "22"},
{value: 24, displayValue: "24"},
{value: 26, displayValue: "26"},
{value: 28, displayValue: "28"},
{value: 36, displayValue: "36"},
{value: 48, displayValue: "48"},
{value: 72, displayValue: "72"},
{value: 96, displayValue: "96"}
]
});
this.cmbFontSize.setValue('');
textBarBtns.push(this.cmbFontSize);

this.btnBold = new Common.UI.Button({
parentEl: $('#text-bar-bold', container),
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-bold',
enableToggle: true,
hint: toolbar.textBold
});
textBarBtns.push(this.btnBold);

this.btnItalic = new Common.UI.Button({
parentEl: $('#text-bar-italic', container),
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-italic',
enableToggle: true,
hint: toolbar.textItalic
});
textBarBtns.push(this.btnItalic);

this.btnTextUnderline = new Common.UI.Button({
parentEl: $('#text-bar-underline', container),
cls : 'btn-toolbar',
iconCls : 'toolbar__icon btn-underline',
enableToggle: true,
hint: toolbar.textUnderline
});
textBarBtns.push(this.btnTextUnderline);

this.btnTextStrikeout = new Common.UI.Button({
parentEl: $('#text-bar-strikeout', container),
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-strikeout',
enableToggle: true,
hint: toolbar.textStrikeout
});
textBarBtns.push(this.btnTextStrikeout);

this.btnSuperscript = new Common.UI.Button({
parentEl: $('#text-bar-super', container),
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-superscript',
enableToggle: true,
toggleGroup: 'superscriptGroup',
hint: toolbar.textSuperscript
});
textBarBtns.push(this.btnSuperscript);

this.btnSubscript = new Common.UI.Button({
parentEl: $('#text-bar-sub', container),
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-subscript',
enableToggle: true,
toggleGroup: 'superscriptGroup',
hint: toolbar.textSubscript
});
textBarBtns.push(this.btnSubscript);

var config = Common.UI.simpleColorsConfig;
this.btnFontColor = new Common.UI.ButtonColored({
parentEl: $('#text-bar-textcolor', container),
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-fontcolor',
split: true,
menu: true,
colors: config.colors,
color: '000000',
dynamiccolors: config.dynamiccolors,
themecolors: config.themecolors,
effects: config.effects,
columns: config.columns,
paletteCls: config.cls,
paletteWidth: config.paletteWidth,
hint: toolbar.tipFontColor
});
textBarBtns.push(this.btnFontColor);
this.btnFontColor.setMenu();
this.mnuFontColorPicker = this.btnFontColor.getPicker();
this.btnFontColor.currentColor = this.btnFontColor.color;

return container;
},

createAnnotBar: function(annotBarBtns) {
var container = $('<div id="annot-bar-container" style="position: absolute;">' +
'<div id="annot-bar-copy" style="display:inline-block;" class=""></div>' +
'<div class="separator margin-left-6"></div>' +
'<div id="annot-bar-add-comment" style="display:inline-block;" class="margin-left-13"></div>' +
'<div id="annot-bar-highlight" style="display:inline-block;" class="margin-left-4"></div>' +
'<div id="annot-bar-underline" style="display:inline-block;" class="margin-left-4"></div>' +
'<div id="annot-bar-strikeout" style="display:inline-block;" class="margin-left-4"></div>' +
'<div class="separator margin-left-6"></div>' +
'<div id="annot-bar-edit-text" class="margin-left-13" style="display:inline-block;"></div>' +
'</div>'),
toolbarController = PDFE.getController('Toolbar'),
toolbar = toolbarController.getView('Toolbar');

this.btnCopy = new Common.UI.Button({
parentEl: $('#annot-bar-copy', container),
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-copy',
hint: toolbar.tipCopy
});
annotBarBtns.push(this.btnCopy);

this.btnAddComment = new Common.UI.Button({
parentEl: $('#annot-bar-add-comment', container),
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-add-comment',
hint: toolbar.tipAddComment
});
annotBarBtns.push(this.btnAddComment);

var config = Common.UI.simpleColorsConfig;
this.btnUnderline = new Common.UI.ButtonColored({
parentEl: $('#annot-bar-underline', container),
cls : 'btn-toolbar',
iconCls : 'toolbar__icon btn-underline',
enableToggle: true,
allowDepress: true,
split: true,
menu: true,
hideColorLine: true,
colors: config.colors,
color: '3D8A44',
dynamiccolors: config.dynamiccolors,
themecolors: config.themecolors,
effects: config.effects,
columns: config.columns,
paletteCls: config.cls,
paletteWidth: config.paletteWidth,
storageSuffix: '-draw',
hint: toolbar.textUnderline,
type: AscPDF.ANNOTATIONS_TYPES.Underline
});
annotBarBtns.push(this.btnUnderline);
this.btnUnderline.setMenu();
this.mnuUnderlineColorPicker = this.btnUnderline.getPicker();
this.btnUnderline.currentColor = this.btnUnderline.color;

this.btnStrikeout = new Common.UI.ButtonColored({
parentEl: $('#annot-bar-strikeout', container),
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-strikeout',
enableToggle: true,
allowDepress: true,
split: true,
menu: true,
hideColorLine: true,
colors: config.colors,
color: 'D43230',
dynamiccolors: config.dynamiccolors,
themecolors: config.themecolors,
effects: config.effects,
columns: config.columns,
paletteCls: config.cls,
paletteWidth: config.paletteWidth,
storageSuffix: '-draw',
hint: toolbar.textStrikeout,
type: AscPDF.ANNOTATIONS_TYPES.Strikeout
});
annotBarBtns.push(this.btnStrikeout);
this.btnStrikeout.setMenu();
this.mnuStrikeoutColorPicker = this.btnStrikeout.getPicker();
this.btnStrikeout.currentColor = this.btnStrikeout.color;

this.btnHighlight = new Common.UI.ButtonColored({
parentEl: $('#annot-bar-highlight', container),
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-highlight',
enableToggle: true,
allowDepress: true,
split: true,
menu: true,
colors: [
'FFFC54', '72F54A', '74F9FD', 'EB51F7', 'A900F9', 'EF8B3A', '7272FF', 'FF63A4', '1DFF92', '03DA18',
'249B01', 'C504D2', '0633D1', 'FFF7A0', 'FF0303', 'FFFFFF', 'D3D3D4', '969696', '606060', '000000'
],
color: 'FFFC54',
dynamiccolors: config.dynamiccolors,
themecolors: config.themecolors,
effects: config.effects,
columns: config.columns,
paletteCls: config.cls,
paletteWidth: config.paletteWidth,
storageSuffix: '-draw',
hint: toolbar.textHighlight,
type: AscPDF.ANNOTATIONS_TYPES.Highlight
});
annotBarBtns.push(this.btnHighlight);
this.btnHighlight.setMenu();
this.mnuHighlightColorPicker = this.btnHighlight.getPicker();
this.btnHighlight.currentColor = this.btnHighlight.color;

this.btnEditText = new Common.UI.Button({
parentEl: $('#annot-bar-edit-text', container),
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-magic-wand',
caption: this.textRecognize,
hint: this.tipRecognize
});
annotBarBtns.push(this.btnEditText);
this.fireEvent('annotbar:create', [this.btnStrikeout, this.mnuStrikeoutColorPicker, this.btnUnderline, this.mnuUnderlineColorPicker, this.btnHighlight, this.mnuHighlightColorPicker]);

return container;
},
createAnnotBar: function(annotBarBtns) {},

focus: function() {
var me = this;
Expand Down
Loading

0 comments on commit c973ced

Please sign in to comment.