@innovastudio/contentbuilder 1.4.52 → 1.4.54

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@innovastudio/contentbuilder",
3
3
  "type": "module",
4
- "version": "1.4.52",
4
+ "version": "1.4.54",
5
5
  "description": "",
6
6
  "main": "public/contentbuilder/contentbuilder.esm.js",
7
7
  "files": [
@@ -1332,7 +1332,7 @@ button:focus-visible {
1332
1332
  height: auto;
1333
1333
  width: 0;
1334
1334
  flex-direction: column;
1335
- box-shadow: rgba(0, 0, 0, 0.04) 5px 0px 9px 0px;
1335
+ box-shadow: rgba(0, 0, 0, 0.05) 5px 0px 9px 0px;
1336
1336
  }
1337
1337
  #_cbhtml[toolbarleft] .is-rte-pop > div,
1338
1338
  .is-ui[toolbarleft] .is-rte-pop > div {
@@ -1587,7 +1587,7 @@ button:focus-visible {
1587
1587
  height: auto;
1588
1588
  width: 0;
1589
1589
  flex-direction: column;
1590
- box-shadow: rgba(0, 0, 0, 0.04) -6px 1px 9px 0px;
1590
+ box-shadow: rgba(0, 0, 0, 0.05) -6px 1px 9px 0px;
1591
1591
  }
1592
1592
  #_cbhtml[toolbarright] .is-rte-pop > div,
1593
1593
  .is-ui[toolbarright] .is-rte-pop > div {
@@ -1846,7 +1846,7 @@ button:focus-visible {
1846
1846
  left: 0;
1847
1847
  display: none;
1848
1848
  z-index: 10004;
1849
- background: rgba(0, 0, 0, 0.07);
1849
+ background: rgba(0, 0, 0, 0.04);
1850
1850
  justify-content: center;
1851
1851
  align-items: center;
1852
1852
  flex-direction: column;
@@ -1949,14 +1949,14 @@ button:focus-visible {
1949
1949
  left: 0;
1950
1950
  width: 100%;
1951
1951
  height: 100%;
1952
- background: rgba(0, 0, 0, 0.07);
1952
+ background: rgba(0, 0, 0, 0.04);
1953
1953
  z-index: -1;
1954
1954
  max-width: none !important;
1955
1955
  margin: 0 !important;
1956
1956
  }
1957
1957
  #_cbhtml .is-modal .is-modal-overlay.overlay-stay,
1958
1958
  .is-ui .is-modal .is-modal-overlay.overlay-stay {
1959
- background: rgba(0, 0, 0, 0.07);
1959
+ background: rgba(0, 0, 0, 0.04);
1960
1960
  }
1961
1961
  #_cbhtml .is-modal.is-modal-content,
1962
1962
  #_cbhtml .is-modal .is-modal-content,
@@ -2049,13 +2049,19 @@ button:focus-visible {
2049
2049
  .is-ui .is-modal div.is-modal-footer button {
2050
2050
  margin-left: 2px;
2051
2051
  }
2052
- #_cbhtml .is-modal.fileselect, #_cbhtml .is-modal.mediaselect, #_cbhtml .is-modal.imageselect, #_cbhtml .is-modal.videoselect, #_cbhtml .is-modal.otherselect,
2052
+ #_cbhtml .is-modal.fileselect, #_cbhtml .is-modal.mediaselect, #_cbhtml .is-modal.imageselect, #_cbhtml .is-modal.videoselect, #_cbhtml .is-modal.otherselect, #_cbhtml .is-modal.pickcolorclass, #_cbhtml .is-modal.imagesource, #_cbhtml .is-modal.imageadjust, #_cbhtml .is-modal.imageadjust2, #_cbhtml .is-modal.audioselect, #_cbhtml .is-modal.mediasource,
2053
2053
  .is-ui .is-modal.fileselect,
2054
2054
  .is-ui .is-modal.mediaselect,
2055
2055
  .is-ui .is-modal.imageselect,
2056
2056
  .is-ui .is-modal.videoselect,
2057
- .is-ui .is-modal.otherselect {
2058
- z-index: 10005;
2057
+ .is-ui .is-modal.otherselect,
2058
+ .is-ui .is-modal.pickcolorclass,
2059
+ .is-ui .is-modal.imagesource,
2060
+ .is-ui .is-modal.imageadjust,
2061
+ .is-ui .is-modal.imageadjust2,
2062
+ .is-ui .is-modal.audioselect,
2063
+ .is-ui .is-modal.mediasource {
2064
+ z-index: 10005 !important;
2059
2065
  }
2060
2066
  #_cbhtml .is-modal.previewcontent,
2061
2067
  .is-ui .is-modal.previewcontent {
@@ -2341,6 +2347,14 @@ button:focus-visible {
2341
2347
  font-weight: 500;
2342
2348
  padding-top: 20px;
2343
2349
  }
2350
+ #_cbhtml .is-modal.pickcolor,
2351
+ .is-ui .is-modal.pickcolor {
2352
+ background: rgba(255, 255, 255, 0);
2353
+ }
2354
+ #_cbhtml .is-modal.pickcolor .is-modal-overlay,
2355
+ .is-ui .is-modal.pickcolor .is-modal-overlay {
2356
+ background: rgba(255, 255, 255, 0);
2357
+ }
2344
2358
  #_cbhtml .is-modal.buttoneditor,
2345
2359
  .is-ui .is-modal.buttoneditor {
2346
2360
  z-index: 10002;
@@ -3967,7 +3981,8 @@ button:focus-visible {
3967
3981
  .is-ui .elementstyles {
3968
3982
  width: 300px;
3969
3983
  font-size: 13px;
3970
- z-index: 10005;
3984
+ z-index: 10004;
3985
+ /*10005*/
3971
3986
  }
3972
3987
  #_cbhtml .elementstyles .elm-list,
3973
3988
  .is-ui .elementstyles .elm-list {
@@ -68931,165 +68931,9 @@ class Rte {
68931
68931
  // old 8368
68932
68932
 
68933
68933
  this.builder.uo.saveForUndo();
68934
- let elm;
68935
- try {
68936
- let curr;
68937
- if (this.builder.win.getSelection) {
68938
- curr = this.builder.win.getSelection().getRangeAt(0).commonAncestorContainer;
68939
- if (curr.nodeType === 3) {
68940
- //text node
68941
- elm = curr.parentNode;
68942
- } else {
68943
- elm = curr;
68944
- }
68945
- } else if (this.builder.doc.selection) {
68946
- curr = this.builder.doc.selection.createRange();
68947
- elm = this.builder.doc.selection.createRange().parentElement();
68948
- }
68949
- } catch (e) {
68950
- return;
68951
- }
68952
68934
  const command = btn.getAttribute('data-command');
68953
68935
  var text = dom.getSelected();
68954
- if (command === 'bold') {
68955
- if (this.builder.useCssClasses) {
68956
- dom.execCommandToggle('fontWeight', '', this.builder.cssClasses);
68957
- } else {
68958
- if (text.trim() === '') {
68959
- var tagname = elm.tagName.toLowerCase();
68960
- if (tagname === 'b') {
68961
- dom.selectElementContents(elm);
68962
- this.builder.doc.execCommand('bold', false, null);
68963
- } else {
68964
- if (elm.style.fontWeight === 'bold' || elm.style.fontWeight > 400) {
68965
- elm.style.fontWeight = '';
68966
- } else {
68967
- elm.style.fontWeight = 'bold';
68968
- }
68969
- }
68970
- } else {
68971
- this.builder.doc.execCommand('bold', false, null);
68972
- }
68973
- }
68974
- }
68975
- if (command === 'italic') {
68976
- if (this.builder.useCssClasses) {
68977
- dom.execCommandToggle('fontStyle', '', this.builder.cssClasses);
68978
- } else {
68979
- if (text.trim() === '') {
68980
- tagname = elm.tagName.toLowerCase();
68981
- if (tagname === 'i') {
68982
- dom.selectElementContents(elm);
68983
- this.builder.doc.execCommand('italic', false, null);
68984
- } else {
68985
- let fontStyle = window.getComputedStyle(elm).getPropertyValue('font-style');
68986
- if (fontStyle === 'italic') {
68987
- elm.style.fontStyle = 'normal';
68988
- } else {
68989
- elm.style.fontStyle = 'italic';
68990
- }
68991
- }
68992
- } else {
68993
- this.builder.doc.execCommand('italic', false, null);
68994
- }
68995
- }
68996
- }
68997
- if (command === 'underline') {
68998
- if (this.builder.useCssClasses) {
68999
- dom.execCommandToggle('textUnderline', '', this.builder.cssClasses);
69000
- } else {
69001
- if (text.trim() === '') {
69002
- tagname = elm.tagName.toLowerCase();
69003
- if (tagname === 'u') {
69004
- dom.selectElementContents(elm);
69005
- this.builder.doc.execCommand('underline', false, null);
69006
- } else {
69007
- if (elm.style.textDecoration.indexOf('underline') !== -1) {
69008
- elm.style.textDecoration = '';
69009
- } else {
69010
- elm.style.textDecoration = 'underline';
69011
- }
69012
- }
69013
- } else {
69014
- this.builder.doc.execCommand('underline', false, null);
69015
- }
69016
- }
69017
- }
69018
- if (command === 'strikethrough') {
69019
- if (this.builder.useCssClasses) {
69020
- dom.execCommandToggle('textLinethrough', '', this.builder.cssClasses);
69021
- } else {
69022
- if (text.trim() === '') {
69023
- tagname = elm.tagName.toLowerCase();
69024
- if (tagname === 'strike') {
69025
- dom.selectElementContents(elm);
69026
- this.builder.doc.execCommand('strikethrough', false, null);
69027
- } else {
69028
- if (elm.style.textDecoration.indexOf('line-through') !== -1) {
69029
- elm.style.textDecoration = '';
69030
- } else {
69031
- elm.style.textDecoration = 'line-through';
69032
- }
69033
- }
69034
- } else {
69035
- this.builder.doc.execCommand('strikethrough', false, null);
69036
- }
69037
- }
69038
- }
69039
- if (command === 'superscript') {
69040
- if (this.builder.useCssClasses) {
69041
- dom.execCommandToggle('extend', 'superscript', this.builder.cssClasses);
69042
- } else {
69043
- this.builder.doc.execCommand('superscript', false, null);
69044
- }
69045
- }
69046
- if (command === 'subscript') {
69047
- if (this.builder.useCssClasses) {
69048
- dom.execCommandToggle('extend', 'subscript', this.builder.cssClasses);
69049
- } else {
69050
- this.builder.doc.execCommand('subscript', false, null);
69051
- }
69052
- }
69053
- if (command === 'uppercase') {
69054
- if (this.builder.useCssClasses) {
69055
- dom.execCommandToggle('textTransform', '', this.builder.cssClasses);
69056
- } else {
69057
- let textTransform = window.getComputedStyle(elm).getPropertyValue('text-transform');
69058
- if (textTransform === 'uppercase') {
69059
- elm.style.textTransform = 'lowercase';
69060
- } else if (textTransform === 'lowercase') {
69061
- elm.style.textTransform = 'capitalize';
69062
- } else if (textTransform === 'capitalize') {
69063
- elm.style.textTransform = 'none';
69064
- } else if (textTransform === 'none') {
69065
- elm.style.textTransform = 'uppercase';
69066
- } else {
69067
- elm.style.textTransform = 'none';
69068
- }
69069
- }
69070
- }
69071
- if (command === 'clean') {
69072
- if (this.builder.useCssClasses) {
69073
- this.builder.doc.execCommand('removeFormat', false, null); // optional: backward compatible (for cleaning old b, i tags)
69074
- dom.execCommandToggle('clean', '', this.builder.cssClasses);
69075
- } else {
69076
- if (text.trim() === '') {
69077
- elm.style.cssText = '';
69078
- elm.className = '';
69079
- } else {
69080
- if (elm.innerText.replace(/(\r\n|\n|\r)/gm, '') === text.trim().replace(/(\r\n|\n|\r)/gm, '')) {
69081
- elm.style.cssText = '';
69082
- elm.className = '';
69083
- this.builder.doc.execCommand('removeFormat', false, null);
69084
- this.builder.doc.execCommand('removeFormat', false, null);
69085
- } else {
69086
- this.builder.doc.execCommand('removeFormat', false, null);
69087
- this.builder.doc.execCommand('removeFormat', false, null);
69088
- }
69089
- }
69090
- }
69091
- }
69092
- this.getState();
68936
+ this.formatText(command);
69093
68937
 
69094
68938
  //save selection (only for desktop)
69095
68939
  if (!this.builder.isTouchSupport) {
@@ -70166,6 +70010,346 @@ class Rte {
70166
70010
  }
70167
70011
  }, 300);
70168
70012
  }
70013
+ formatText(command) {
70014
+ const dom = this.builder.dom;
70015
+ let elm;
70016
+ try {
70017
+ let curr;
70018
+ if (this.builder.win.getSelection) {
70019
+ curr = this.builder.win.getSelection().getRangeAt(0).commonAncestorContainer;
70020
+ if (curr.nodeType === 3) {
70021
+ //text node
70022
+ elm = curr.parentNode;
70023
+ } else {
70024
+ elm = curr;
70025
+ }
70026
+ } else if (this.builder.doc.selection) {
70027
+ curr = this.builder.doc.selection.createRange();
70028
+ elm = this.builder.doc.selection.createRange().parentElement();
70029
+ }
70030
+ } catch (e) {
70031
+ return;
70032
+ }
70033
+ var text = dom.getSelected();
70034
+ if (command === 'bold') {
70035
+ if (this.builder.useCssClasses) {
70036
+ dom.execCommandToggle('fontWeight', '', this.builder.cssClasses);
70037
+ } else {
70038
+ if (text.trim() === '') {
70039
+ var tagname = elm.tagName.toLowerCase();
70040
+ if (tagname === 'b') {
70041
+ dom.selectElementContents(elm);
70042
+ this.builder.doc.execCommand('bold', false, null);
70043
+ } else {
70044
+ if (elm.style.fontWeight === 'bold' || elm.style.fontWeight > 400) {
70045
+ elm.style.fontWeight = '';
70046
+ } else {
70047
+ elm.style.fontWeight = 'bold';
70048
+ }
70049
+ }
70050
+ } else {
70051
+ this.builder.doc.execCommand('bold', false, null);
70052
+ }
70053
+ }
70054
+ }
70055
+ if (command === 'italic') {
70056
+ if (this.builder.useCssClasses) {
70057
+ dom.execCommandToggle('fontStyle', '', this.builder.cssClasses);
70058
+ } else {
70059
+ if (text.trim() === '') {
70060
+ tagname = elm.tagName.toLowerCase();
70061
+ if (tagname === 'i') {
70062
+ dom.selectElementContents(elm);
70063
+ this.builder.doc.execCommand('italic', false, null);
70064
+ } else {
70065
+ let fontStyle = window.getComputedStyle(elm).getPropertyValue('font-style');
70066
+ if (fontStyle === 'italic') {
70067
+ elm.style.fontStyle = 'normal';
70068
+ } else {
70069
+ elm.style.fontStyle = 'italic';
70070
+ }
70071
+ }
70072
+ } else {
70073
+ this.builder.doc.execCommand('italic', false, null);
70074
+ }
70075
+ }
70076
+ }
70077
+ if (command === 'underline') {
70078
+ if (this.builder.useCssClasses) {
70079
+ dom.execCommandToggle('textUnderline', '', this.builder.cssClasses);
70080
+ } else {
70081
+ if (text.trim() === '') {
70082
+ tagname = elm.tagName.toLowerCase();
70083
+ if (tagname === 'u') {
70084
+ dom.selectElementContents(elm);
70085
+ this.builder.doc.execCommand('underline', false, null);
70086
+ } else {
70087
+ if (elm.style.textDecoration.indexOf('underline') !== -1) {
70088
+ elm.style.textDecoration = '';
70089
+ } else {
70090
+ elm.style.textDecoration = 'underline';
70091
+ }
70092
+ }
70093
+ } else {
70094
+ this.builder.doc.execCommand('underline', false, null);
70095
+ }
70096
+ }
70097
+ }
70098
+ if (command === 'strikethrough') {
70099
+ if (this.builder.useCssClasses) {
70100
+ dom.execCommandToggle('textLinethrough', '', this.builder.cssClasses);
70101
+ } else {
70102
+ if (text.trim() === '') {
70103
+ tagname = elm.tagName.toLowerCase();
70104
+ if (tagname === 'strike') {
70105
+ dom.selectElementContents(elm);
70106
+ this.builder.doc.execCommand('strikethrough', false, null);
70107
+ } else {
70108
+ if (elm.style.textDecoration.indexOf('line-through') !== -1) {
70109
+ elm.style.textDecoration = '';
70110
+ } else {
70111
+ elm.style.textDecoration = 'line-through';
70112
+ }
70113
+ }
70114
+ } else {
70115
+ this.builder.doc.execCommand('strikethrough', false, null);
70116
+ }
70117
+ }
70118
+ }
70119
+ if (command === 'superscript') {
70120
+ if (this.builder.useCssClasses) {
70121
+ dom.execCommandToggle('extend', 'superscript', this.builder.cssClasses);
70122
+ } else {
70123
+ this.builder.doc.execCommand('superscript', false, null);
70124
+ }
70125
+ }
70126
+ if (command === 'subscript') {
70127
+ if (this.builder.useCssClasses) {
70128
+ dom.execCommandToggle('extend', 'subscript', this.builder.cssClasses);
70129
+ } else {
70130
+ this.builder.doc.execCommand('subscript', false, null);
70131
+ }
70132
+ }
70133
+ if (command === 'uppercase') {
70134
+ if (this.builder.useCssClasses) {
70135
+ dom.execCommandToggle('textTransform', '', this.builder.cssClasses);
70136
+ } else {
70137
+ let textTransform = window.getComputedStyle(elm).getPropertyValue('text-transform');
70138
+ if (textTransform === 'uppercase') {
70139
+ elm.style.textTransform = 'lowercase';
70140
+ } else if (textTransform === 'lowercase') {
70141
+ elm.style.textTransform = 'capitalize';
70142
+ } else if (textTransform === 'capitalize') {
70143
+ elm.style.textTransform = 'none';
70144
+ } else if (textTransform === 'none') {
70145
+ elm.style.textTransform = 'uppercase';
70146
+ } else {
70147
+ elm.style.textTransform = 'none';
70148
+ }
70149
+ }
70150
+ }
70151
+ if (command === 'clean') {
70152
+ if (this.builder.useCssClasses) {
70153
+ this.builder.doc.execCommand('removeFormat', false, null); // optional: backward compatible (for cleaning old b, i tags)
70154
+ dom.execCommandToggle('clean', '', this.builder.cssClasses);
70155
+ } else {
70156
+ if (text.trim() === '') {
70157
+ elm.style.cssText = '';
70158
+ elm.className = '';
70159
+ } else {
70160
+ if (elm.innerText.replace(/(\r\n|\n|\r)/gm, '') === text.trim().replace(/(\r\n|\n|\r)/gm, '')) {
70161
+ elm.style.cssText = '';
70162
+ elm.className = '';
70163
+ this.builder.doc.execCommand('removeFormat', false, null);
70164
+ this.builder.doc.execCommand('removeFormat', false, null);
70165
+ } else {
70166
+ this.builder.doc.execCommand('removeFormat', false, null);
70167
+ this.builder.doc.execCommand('removeFormat', false, null);
70168
+ }
70169
+ }
70170
+ }
70171
+ }
70172
+ this.getState();
70173
+ }
70174
+ formatTextNonToggle(command) {
70175
+ const dom = this.builder.dom;
70176
+ let elm;
70177
+ try {
70178
+ let curr;
70179
+ if (this.builder.win.getSelection) {
70180
+ curr = this.builder.win.getSelection().getRangeAt(0).commonAncestorContainer;
70181
+ if (curr.nodeType === 3) {
70182
+ //text node
70183
+ elm = curr.parentNode;
70184
+ } else {
70185
+ elm = curr;
70186
+ }
70187
+ } else if (this.builder.doc.selection) {
70188
+ curr = this.builder.doc.selection.createRange();
70189
+ elm = this.builder.doc.selection.createRange().parentElement();
70190
+ }
70191
+ } catch (e) {
70192
+ return;
70193
+ }
70194
+ var text = dom.getSelected();
70195
+ if (command === 'bold') {
70196
+ dom.execCommand('text-weight', 'bold', (ok, container) => {
70197
+ if (this.builder.useCssClasses) {
70198
+ if (container) {
70199
+ const config = this.builder.cssClasses;
70200
+ container.classList.remove(config.fontWeight.thin);
70201
+ container.classList.remove(config.fontWeight.extralight);
70202
+ container.classList.remove(config.fontWeight.light);
70203
+ container.classList.remove(config.fontWeight.normal);
70204
+ container.classList.remove(config.fontWeight.semibold);
70205
+ container.classList.remove(config.fontWeight.bold);
70206
+ container.classList.remove(config.fontWeight.extrabold);
70207
+ container.classList.remove(config.fontWeight.black);
70208
+ container.classList.remove(config.fontWeight.defaultBold);
70209
+ container.classList.remove(config.fontWeight.defaultNormal);
70210
+ container.classList.add(config.fontWeight.semibold);
70211
+ dom.doFunction(container, function (theEl) {
70212
+ theEl.style.fontWeight = '';
70213
+ }, true);
70214
+ }
70215
+ }
70216
+ });
70217
+ }
70218
+ if (command === 'italic') {
70219
+ dom.execCommand('text-style', 'italic', (ok, container) => {
70220
+ if (this.builder.useCssClasses) {
70221
+ if (container) {
70222
+ const config = this.builder.cssClasses;
70223
+ container.classList.remove(config.fontStyle.italic);
70224
+ container.classList.remove(config.fontStyle.normal);
70225
+ container.classList.add(config.fontStyle.italic);
70226
+ dom.doFunction(container, function (theEl) {
70227
+ theEl.style.fontStyle = '';
70228
+ }, true);
70229
+ }
70230
+ }
70231
+ });
70232
+ }
70233
+ if (command === 'underline') {
70234
+ dom.execCommand('text-decoration', 'underline', (ok, container) => {
70235
+ if (this.builder.useCssClasses) {
70236
+ if (container) {
70237
+ const config = this.builder.cssClasses;
70238
+ container.classList.remove(config.textDecoration.underline);
70239
+ container.classList.remove(config.textDecoration.linethrough);
70240
+ container.classList.remove(config.textDecoration.normal);
70241
+ container.classList.add(config.textDecoration.underline);
70242
+ dom.doFunction(container, function (theEl) {
70243
+ theEl.style.textDecoration = '';
70244
+ }, true);
70245
+ }
70246
+ }
70247
+ });
70248
+ }
70249
+ if (command === 'strikethrough') {
70250
+ dom.execCommand('text-decoration', 'line-through', (ok, container) => {
70251
+ if (this.builder.useCssClasses) {
70252
+ if (container) {
70253
+ const config = this.builder.cssClasses;
70254
+ container.classList.remove(config.textDecoration.underline);
70255
+ container.classList.remove(config.textDecoration.linethrough);
70256
+ container.classList.remove(config.textDecoration.normal);
70257
+ container.classList.add(config.textDecoration.linethrough);
70258
+ dom.doFunction(container, function (theEl) {
70259
+ theEl.style.textDecoration = '';
70260
+ }, true);
70261
+ }
70262
+ }
70263
+ });
70264
+ }
70265
+ if (command === 'superscript') {
70266
+ if (this.builder.useCssClasses) {
70267
+ dom.execCommandToggle('extend', 'superscript', this.builder.cssClasses);
70268
+ } else {
70269
+ this.builder.doc.execCommand('superscript', false, null);
70270
+ }
70271
+ }
70272
+ if (command === 'subscript') {
70273
+ if (this.builder.useCssClasses) {
70274
+ dom.execCommandToggle('extend', 'subscript', this.builder.cssClasses);
70275
+ } else {
70276
+ this.builder.doc.execCommand('subscript', false, null);
70277
+ }
70278
+ }
70279
+ if (command === 'uppercase') {
70280
+ dom.execCommand('text-transform', 'uppercase', (ok, container) => {
70281
+ if (this.builder.useCssClasses) {
70282
+ if (container) {
70283
+ const config = this.builder.cssClasses;
70284
+ container.classList.remove(config.textTransform.uppercase);
70285
+ container.classList.remove(config.textTransform.lowercase);
70286
+ container.classList.remove(config.textTransform.capitalize);
70287
+ container.classList.remove(config.textTransform.normal);
70288
+ container.classList.add(config.textTransform.uppercase);
70289
+ dom.doFunction(container, function (theEl) {
70290
+ theEl.style.textTransform = '';
70291
+ }, true);
70292
+ }
70293
+ }
70294
+ });
70295
+ }
70296
+ if (command === 'lowercase') {
70297
+ dom.execCommand('text-transform', 'lowercase', (ok, container) => {
70298
+ if (this.builder.useCssClasses) {
70299
+ if (container) {
70300
+ const config = this.builder.cssClasses;
70301
+ container.classList.remove(config.textTransform.uppercase);
70302
+ container.classList.remove(config.textTransform.lowercase);
70303
+ container.classList.remove(config.textTransform.capitalize);
70304
+ container.classList.remove(config.textTransform.normal);
70305
+ container.classList.add(config.textTransform.lowercase);
70306
+ dom.doFunction(container, function (theEl) {
70307
+ theEl.style.textTransform = '';
70308
+ }, true);
70309
+ }
70310
+ }
70311
+ });
70312
+ }
70313
+ if (command === 'capitalize') {
70314
+ dom.execCommand('text-transform', 'capitalize', (ok, container) => {
70315
+ if (this.builder.useCssClasses) {
70316
+ if (container) {
70317
+ const config = this.builder.cssClasses;
70318
+ container.classList.remove(config.textTransform.uppercase);
70319
+ container.classList.remove(config.textTransform.lowercase);
70320
+ container.classList.remove(config.textTransform.capitalize);
70321
+ container.classList.remove(config.textTransform.normal);
70322
+ container.classList.add(config.textTransform.capitalize);
70323
+ dom.doFunction(container, function (theEl) {
70324
+ theEl.style.textTransform = '';
70325
+ }, true);
70326
+ }
70327
+ }
70328
+ });
70329
+ }
70330
+ if (command === 'clean') {
70331
+ if (this.builder.useCssClasses) {
70332
+ this.builder.doc.execCommand('removeFormat', false, null); // optional: backward compatible (for cleaning old b, i tags)
70333
+ dom.execCommandToggle('clean', '', this.builder.cssClasses);
70334
+ } else {
70335
+ if (text.trim() === '') {
70336
+ elm.style.cssText = '';
70337
+ elm.className = '';
70338
+ } else {
70339
+ if (elm.innerText.replace(/(\r\n|\n|\r)/gm, '') === text.trim().replace(/(\r\n|\n|\r)/gm, '')) {
70340
+ elm.style.cssText = '';
70341
+ elm.className = '';
70342
+ this.builder.doc.execCommand('removeFormat', false, null);
70343
+ this.builder.doc.execCommand('removeFormat', false, null);
70344
+ } else {
70345
+ this.builder.doc.execCommand('removeFormat', false, null);
70346
+ this.builder.doc.execCommand('removeFormat', false, null);
70347
+ }
70348
+ }
70349
+ }
70350
+ }
70351
+ this.getState();
70352
+ }
70169
70353
  insertImage() {
70170
70354
  const dom = this.dom;
70171
70355
  const modalInsertImage = this.builderStuff.querySelector('.insertimage');
@@ -78183,6 +78367,12 @@ class ContentBuilder {
78183
78367
  this.targetAssetType = targetAssetType;
78184
78368
  }
78185
78369
  }
78370
+ formatText(command) {
78371
+ this.rte.formatText(command);
78372
+ }
78373
+ formatTextNonToggle(command) {
78374
+ this.rte.formatTextNonToggle(command);
78375
+ }
78186
78376
  LightenDarkenColor(col, amt) {
78187
78377
  // Backward compatibility (used by: Button Editor plugin)
78188
78378
  return this.util.LightenDarkenColor(col, amt);