[Libreoffice-commits] online.git: loleaflet/src
Andrzej Hunt
andrzej.hunt at collabora.com
Thu Nov 12 04:57:06 PST 2015
loleaflet/src/control/Control.Styles.js | 17 ++++++++++-------
loleaflet/src/control/Toolbar.js | 6 +++---
2 files changed, 13 insertions(+), 10 deletions(-)
New commits:
commit e103a0b59a6741b0bb94f15d2c41dec340b7bea8
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date: Thu Nov 12 13:55:55 2015 +0100
loleaflet: support commands list instead of ClearStyle
This allows further commands to be added purely server-side.
diff --git a/loleaflet/src/control/Control.Styles.js b/loleaflet/src/control/Control.Styles.js
index 31b0dac..da1c4ca 100644
--- a/loleaflet/src/control/Control.Styles.js
+++ b/loleaflet/src/control/Control.Styles.js
@@ -53,11 +53,14 @@ L.Control.Styles = L.Control.extend({
styles = e.commandValues['CellStyles'];
}
- this._addSeparator();
- if (e.commandValues['ClearStyle']) {
- var item = L.DomUtil.create('option', '', container);
- item.value = 'ClearStyle';
- item.innerHTML = e.commandValues['ClearStyle'];
+ var commands = e.commandValues['Commands'];
+ if (commands && commands.length > 0) {
+ this._addSeparator();
+ commands.forEach(function (command) {
+ var item = L.DomUtil.create('option', '', container);
+ item.value = command.command;
+ item.innerHTML = command.name;
+ });
}
if (topStyles.length > 0) {
@@ -96,8 +99,8 @@ L.Control.Styles = L.Control.extend({
if (style === this.options.info) {
return;
}
- if (style === 'ClearStyle') {
- this._map.clearStyle();
+ if (style.startsWith('.uno:')) {
+ this._map.sendUnoCommand(style);
}
else if (this._map.getDocType() === 'text') {
this._map.applyStyle(style, 'ParagraphStyles');
diff --git a/loleaflet/src/control/Toolbar.js b/loleaflet/src/control/Toolbar.js
index 52d7f7a..45fe3ef 100644
--- a/loleaflet/src/control/Toolbar.js
+++ b/loleaflet/src/control/Toolbar.js
@@ -77,9 +77,9 @@ L.Map.include({
}
},
- clearStyle: function () {
+ sendUnoCommand: function (command) {
if (this._docLayer._permission === 'edit') {
- L.Socket.sendMessage('uno .uno:ResetAttributes');
+ L.Socket.sendMessage('uno ' + command);
}
},
@@ -88,7 +88,7 @@ L.Map.include({
if (!unoState.startsWith('.uno:')) {
unoState = '.uno:' + unoState;
}
- L.Socket.sendMessage('uno ' + unoState);
+ sendUnoCommand(unoState);
}
},
More information about the Libreoffice-commits
mailing list