loleaflet/src/control/Control.NotebookbarBuilder.js | 28 +++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-)
New commits: commit 7af518127b7fe90370433156a04a2b47b78e10f7 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Wed Apr 29 07:45:08 2020 +0200 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Fri May 1 19:46:09 2020 +0200 notebookbar: insert graphic menu Change-Id: If14b2fdacc7e317eed0a557669a8bdf8c5ab69cf Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93288 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> diff --git a/loleaflet/src/control/Control.NotebookbarBuilder.js b/loleaflet/src/control/Control.NotebookbarBuilder.js index 34e08d834..3751ec75f 100644 --- a/loleaflet/src/control/Control.NotebookbarBuilder.js +++ b/loleaflet/src/control/Control.NotebookbarBuilder.js @@ -3,7 +3,7 @@ * L.Control.NotebookbarBuilder */ -/* global $ _ */ +/* global $ _ _UNO */ L.Control.NotebookbarBuilder = L.Control.JSDialogBuilder.extend({ _customizeOptions: function() { @@ -29,6 +29,7 @@ L.Control.NotebookbarBuilder = L.Control.JSDialogBuilder.extend({ this._toolitemHandlers['.uno:FillColor'] = this._colorControl; this._toolitemHandlers['.uno:InsertTable'] = this._insertTableControl; + this._toolitemHandlers['.uno:InsertGraphic'] = this._insertGraphicControl; this._toolitemHandlers['.uno:SelectWidth'] = function() {}; @@ -195,6 +196,31 @@ L.Control.NotebookbarBuilder = L.Control.JSDialogBuilder.extend({ }); }, + _insertGraphicControl: function(parentContainer, data, builder) { + var control = builder._unoToolButton(parentContainer, data, builder); + + $(control.container).unbind('click'); + $(control.container).click(function () { + if (builder.map['wopi'].EnableInsertRemoteImage) { + $(control.container).w2menu({ + items: [ + {id: 'localgraphic', text: _('Insert Local Image')}, + {id: 'remotegraphic', text: _UNO('.uno:InsertGraphic', '', true)} + ], + onSelect: function (event) { + if (event.item.id === 'localgraphic') { + L.DomUtil.get('insertgraphic').click(); + } else if (event.item.id === 'remotegraphic') { + builder.map.fire('postMessage', {msgId: 'UI_InsertGraphic'}); + } + } + }); + } else { + L.DomUtil.get('insertgraphic').click(); + } + }); + }, + build: function(parent, data, hasVerticalParent, parentHasManyChildren) { this._amendJSDialogData(data); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits