[Libreoffice-commits] online.git: 2 commits - loleaflet/src
Szymon KÅos (via logerrit)
logerrit at kemper.freedesktop.org
Fri May 1 16:28:59 UTC 2020
loleaflet/src/control/Control.JSDialogBuilder.js | 10 ++++++
loleaflet/src/control/Control.NotebookbarBuilder.js | 29 ++++++++++++++++++--
loleaflet/src/control/Control.Toolbar.js | 10 ++++++
loleaflet/src/control/Control.TopToolbar.js | 3 --
4 files changed, 47 insertions(+), 5 deletions(-)
New commits:
commit e976ab4889397cca4e2bf938867cf9b7e25c615b
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Apr 27 12:11:23 2020 +0200
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Fri May 1 18:28:51 2020 +0200
notebookbar: generate identifiers for containers
Change-Id: Ib76d9bc78bdfede4774d1b01a38f635b456fb3cd
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93281
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/loleaflet/src/control/Control.NotebookbarBuilder.js b/loleaflet/src/control/Control.NotebookbarBuilder.js
index eb9557c6b..a09435469 100644
--- a/loleaflet/src/control/Control.NotebookbarBuilder.js
+++ b/loleaflet/src/control/Control.NotebookbarBuilder.js
@@ -204,7 +204,8 @@ L.Control.NotebookbarBuilder = L.Control.JSDialogBuilder.extend({
var hasManyChildren = childData.children && childData.children.length > 1;
if (hasManyChildren) {
- var table = L.DomUtil.create('table', '', td);
+ var table = L.DomUtil.createWithId('table', 'table-' + childData.id, td);
+ $(table).addClass(this.options.cssClass);
var childObject = L.DomUtil.create('tr', '', table);
} else {
childObject = td;
commit 29293cbcde18d7d142e5d883fcf581b98201c627
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Apr 27 10:36:25 2020 +0200
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Fri May 1 18:28:41 2020 +0200
notebookbar: uno:Color -> uno:FontColor
Change-Id: Id5c542ee2495cce454a8fcde9e845399950d59ef
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93280
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js
index b6c3591bd..2c1536b09 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -1515,7 +1515,10 @@ L.Control.JSDialogBuilder = L.Control.extend({
_unoToolButton: function(parentContainer, data, builder) {
var button = null;
+ var controls = {};
+
var div = this._createIdentifiable('div', 'unotoolbutton ' + builder.options.cssClass + ' ui-content unospan', parentContainer, data);
+ controls['container'] = div;
if (data.command) {
var id = data.command.substr('.uno:'.length);
@@ -1528,10 +1531,14 @@ L.Control.JSDialogBuilder = L.Control.extend({
button.src = icon;
button.id = buttonId;
+ controls['button'] = button;
+
if (builder.options.noLabelsForUnoButtons !== true) {
var label = L.DomUtil.create('span', 'ui-content unolabel', div);
label.for = buttonId;
label.innerHTML = data.text;
+
+ controls['label'] = label;
} else {
div.title = data.text;
$(div).tooltip();
@@ -1557,6 +1564,7 @@ L.Control.JSDialogBuilder = L.Control.extend({
} else {
button = L.DomUtil.create('label', 'ui-content unolabel', div);
button.innerHTML = builder._cleanText(data.text);
+ controls['label'] = button;
}
$(div).click(function () {
@@ -1567,7 +1575,7 @@ L.Control.JSDialogBuilder = L.Control.extend({
if (data.enabled == 'false')
$(button).attr('disabled', 'disabled');
- return false;
+ return controls;
},
_divContainerHandler: function (parentContainer, data, builder) {
diff --git a/loleaflet/src/control/Control.NotebookbarBuilder.js b/loleaflet/src/control/Control.NotebookbarBuilder.js
index ed3a86417..eb9557c6b 100644
--- a/loleaflet/src/control/Control.NotebookbarBuilder.js
+++ b/loleaflet/src/control/Control.NotebookbarBuilder.js
@@ -18,7 +18,6 @@ L.Control.NotebookbarBuilder = L.Control.JSDialogBuilder.extend({
this._controlHandlers['spinfield'] = function() { return false; };
this._toolitemHandlers['.uno:XLineColor'] = this._colorControl;
- this._toolitemHandlers['.uno:SelectWidth'] = function() {};
this._toolitemHandlers['.uno:FontColor'] = this._colorControl;
this._toolitemHandlers['.uno:BackColor'] = this._colorControl;
this._toolitemHandlers['.uno:CharBackColor'] = this._colorControl;
@@ -26,6 +25,11 @@ L.Control.NotebookbarBuilder = L.Control.JSDialogBuilder.extend({
this._toolitemHandlers['.uno:FrameLineColor'] = this._colorControl;
this._toolitemHandlers['.uno:Color'] = this._colorControl;
this._toolitemHandlers['.uno:FillColor'] = this._colorControl;
+
+ this._toolitemHandlers['.uno:InsertTable'] = this._insertTableControl;
+
+ this._toolitemHandlers['.uno:SelectWidth'] = function() {};
+
this._toolitemHandlers['vnd.sun.star.findbar:FocusToFindbar'] = function() {};
},
@@ -78,6 +82,10 @@ L.Control.NotebookbarBuilder = L.Control.JSDialogBuilder.extend({
},
_colorControl: function(parentContainer, data, builder) {
+ var commandOverride = data.command === '.uno:Color';
+ if (commandOverride)
+ data.command = '.uno:FontColor';
+
var titleOverride = builder._getTitleForControlWithId(data.id);
if (titleOverride)
data.text = titleOverride;
@@ -138,6 +146,22 @@ L.Control.NotebookbarBuilder = L.Control.JSDialogBuilder.extend({
return false;
},
+ _insertTableControl: function(parentContainer, data, builder) {
+ var control = builder._unoToolButton(parentContainer, data, builder);
+
+ $(control.container).unbind('click');
+ $(control.container).click(function () {
+ if (!$('.inserttable-grid').length) {
+ $(control.container).w2overlay(window.getInsertTablePopupHtml());
+ window.insertTable();
+
+ $('.inserttable-grid .row .col').click(function () {
+ $(control.container).w2overlay();
+ });
+ }
+ });
+ },
+
build: function(parent, data, hasVerticalParent, parentHasManyChildren) {
this._amendJSDialogData(data);
diff --git a/loleaflet/src/control/Control.Toolbar.js b/loleaflet/src/control/Control.Toolbar.js
index d1db7a681..7a2290667 100644
--- a/loleaflet/src/control/Control.Toolbar.js
+++ b/loleaflet/src/control/Control.Toolbar.js
@@ -233,6 +233,15 @@ function setConditionalFormatIconSet(num) {
global.setConditionalFormatIconSet = setConditionalFormatIconSet;
+function getInsertTablePopupHtml() {
+ return '<div id="inserttable-wrapper">\
+ <div id="inserttable-popup" class="inserttable-pop ui-widget ui-corner-all">\
+ <div class="inserttable-grid"></div>\
+ <div id="inserttable-status" class="loleaflet-font" style="padding: 5px;"><br/></div>\
+ </div>\
+ </div>';
+}
+
function insertTable() {
var rows = 10;
var cols = 10;
@@ -1053,6 +1062,7 @@ global.setupToolbar = setupToolbar;
global.onClick = onClick;
global.hideTooltip = hideTooltip;
global.insertTable = insertTable;
+global.getInsertTablePopupHtml = getInsertTablePopupHtml;
global.insertShapes = insertShapes;
global.createShapesPanel = createShapesPanel;
global.onUpdatePermission = onUpdatePermission;
diff --git a/loleaflet/src/control/Control.TopToolbar.js b/loleaflet/src/control/Control.TopToolbar.js
index ff5b1d704..0e5f9f51d 100644
--- a/loleaflet/src/control/Control.TopToolbar.js
+++ b/loleaflet/src/control/Control.TopToolbar.js
@@ -215,8 +215,7 @@ L.Control.TopToolbar = L.Control.extend({
{type: 'break', id: 'break-number', hidden: true},
{type: 'button', id: 'inserttextbox', img: 'text', hint: _UNO('.uno:Text', '', true), uno: 'Text?CreateDirectly:bool=true', hidden: true},
{type: 'button', id: 'insertannotation', img: 'annotation', hint: _UNO('.uno:InsertAnnotation', '', true), hidden: true},
- {type: 'drop', id: 'inserttable', img: 'inserttable', hint: _('Insert table'), hidden: true, overlay: {onShow: window.insertTable},
- html: '<div id="inserttable-wrapper"><div id="inserttable-popup" class="inserttable-pop ui-widget ui-corner-all"><div class="inserttable-grid"></div><div id="inserttable-status" class="loleaflet-font" style="padding: 5px;"><br/></div></div></div>'},
+ {type: 'drop', id: 'inserttable', img: 'inserttable', hint: _('Insert table'), hidden: true, overlay: {onShow: window.insertTable}, html: window.getInsertTablePopupHtml()},
{type: 'button', id: 'insertgraphic', img: 'insertgraphic', hint: _UNO('.uno:InsertGraphic', '', true)},
{type: 'menu', id: 'menugraphic', img: 'insertgraphic', hint: _UNO('.uno:InsertGraphic', '', true), hidden: true,
items: [
More information about the Libreoffice-commits
mailing list