From 41c0704ad8f4738c4d872f274519eed9d76a97f8 Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 20 Apr 2020 11:56:12 +0200 Subject: [PATCH] Page mode by default in rich text --- customize.dist/src/less2/include/toolbar.less | 1 + www/common/common-ui-elements.js | 1 - www/common/outer/async-store.js | 3 +++ www/pad/inner.js | 22 ++++++++++++++++++- 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/customize.dist/src/less2/include/toolbar.less b/customize.dist/src/less2/include/toolbar.less index 49654dc56..73e608c4a 100644 --- a/customize.dist/src/less2/include/toolbar.less +++ b/customize.dist/src/less2/include/toolbar.less @@ -1179,6 +1179,7 @@ &.fa-download { order: 2; } &.fa-upload { order: 3; } &.fa-print { order: 4; } + &.fa-arrows-h { order: 5; } &.fa-cog { order: 5; } &.fa-info-circle { order: 6; } &.fa-help { order: 7; } diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 75ee78c15..a5c1396c2 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1651,7 +1651,6 @@ define([ if (data.hiddenReadOnly) { button.addClass('cp-hidden-if-readonly'); } if (data.name) { button.addClass('cp-toolbar-icon-'+data.name); - button.click(common.prepareFeedback(data.name)); } if (data.text) { $('', {'class': 'cp-toolbar-drawer-element'}).text(data.text) diff --git a/www/common/outer/async-store.js b/www/common/outer/async-store.js index 1e41b8e5b..fb7b2cc8e 100644 --- a/www/common/outer/async-store.js +++ b/www/common/outer/async-store.js @@ -38,6 +38,9 @@ define([ drive: { hideDuplicate: true }, + pad: { + width: true + }, general: { allowUserFeedback: true } diff --git a/www/pad/inner.js b/www/pad/inner.js index 632294f43..6de0544ad 100644 --- a/www/pad/inner.js +++ b/www/pad/inner.js @@ -731,10 +731,30 @@ define([ $iframe.find('body').attr('spellcheck', true); } }); + + Messages.pad_useFullWidth = "Use full width"; // XXX + Messages.pad_usePageWidth = "Use page mode"; // XXX framework._.sfCommon.getAttribute(['pad', 'width'], function (err, data) { - if (data) { + var active = data || typeof(data) === "undefined"; + if (active) { $iframe.find('html').addClass('cke_body_width'); } + var $width = framework._.sfCommon.createButton('', true, { + icon: 'fa-arrows-h', + text: active ? Messages.pad_useFullWidth : Messages.pad_usePageWidth, + name: "pad-width", + },function () { + if (active) { + $iframe.find('html').removeClass('cke_body_width'); + } else { + $iframe.find('html').addClass('cke_body_width'); + } + active = !active; + var key = active ? Messages.pad_useFullWidth : Messages.pad_usePageWidth; + $width.find('.cp-toolbar-drawer-element').text(key); + framework._.sfCommon.setAttribute(['pad', 'width'], active); + }); + framework._.toolbar.$drawer.append($width); }); framework._.sfCommon.isPadStored(function (err, val) {