@ostendis/grapesjs-preset-ostendis-adv 1.3.3 → 1.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22566,7 +22566,7 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
22566
22566
  'style': 'padding: 0.2rem 0; margin-left: 2em; line-height: 1.4em;'
22567
22567
  });
22568
22568
  listItems.forEach(itemContent => {
22569
- const liHtml = `<li class="ulistitem" style="text-align: left;"><span class="fa-li" style="left: -2em; width: 2em;"><i class="fas fa-circle" style="font-size: 0.4em; line-height: inherit; display: block;"></i></span><p style="margin: 0; padding: 0; text-align: left;">${itemContent}</p></li>`;
22569
+ const liHtml = `<li class="ulistitem" style="text-align: left;"><span class="fa-li" style="left: -2em; width: 2em;"><i class="fas fa-circle" style="font-size: 0.4em; line-height: inherit; display: block;"></i></span><div>${itemContent}</div></li>`;
22570
22570
  selected.append(liHtml);
22571
22571
  });
22572
22572
  modal.close();
@@ -22608,18 +22608,18 @@ __webpack_require__.r(__webpack_exports__);
22608
22608
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((editor, opts) => {
22609
22609
  const { DomComponents } = editor;
22610
22610
  // Add ostendis block trait to video components
22611
- var dType = DomComponents.getType("video");
22611
+ var dType = DomComponents.getType('video');
22612
22612
  var dModel = dType === null || dType === void 0 ? void 0 : dType.model;
22613
22613
  var dView = dType === null || dType === void 0 ? void 0 : dType.view;
22614
- const yt = "yt";
22615
- const vi = "vi";
22616
- const ytnc = "ytnc";
22617
- DomComponents.addType("video", {
22614
+ const yt = 'yt';
22615
+ const vi = 'vi';
22616
+ const ytnc = 'ytnc';
22617
+ DomComponents.addType('video', {
22618
22618
  model: dModel.extend({
22619
22619
  updateTraits() {
22620
22620
  const { em } = this;
22621
- const prov = this.get("provider");
22622
- let tagName = "iframe";
22621
+ const prov = this.get('provider');
22622
+ let tagName = 'iframe';
22623
22623
  let traits;
22624
22624
  switch (prov) {
22625
22625
  case yt:
@@ -22630,173 +22630,197 @@ __webpack_require__.r(__webpack_exports__);
22630
22630
  traits = this.getVimeoTraits();
22631
22631
  break;
22632
22632
  default:
22633
- tagName = "video";
22633
+ tagName = 'video';
22634
22634
  traits = this.getSourceTraits();
22635
22635
  }
22636
22636
  traits.push({
22637
- type: "select",
22638
- label: "Ostendis Blocks",
22639
- name: "data-ost-type",
22637
+ type: 'select',
22638
+ label: 'Ostendis Blocks',
22639
+ name: 'data-ost-type',
22640
22640
  options: [
22641
- { id: "", name: opts.t9n.traitOstNone },
22642
- { id: "videoURL", name: opts.t9n.traitOstVideoURL },
22641
+ { id: '', name: opts.t9n.traitOstNone },
22642
+ { id: 'videoURL', name: opts.t9n.traitOstVideoURL },
22643
22643
  ],
22644
22644
  });
22645
22645
  this.set({ tagName }, { silent: true }); // avoid break in view
22646
22646
  this.set({ traits });
22647
- em.get("ready") && em.trigger("component:toggled");
22647
+ em.get('ready') && em.trigger('component:toggled');
22648
22648
  },
22649
22649
  }),
22650
22650
  view: dView,
22651
22651
  });
22652
22652
  // Scale the new range
22653
- DomComponents.addType("scale", {
22653
+ DomComponents.addType('scale', {
22654
22654
  isComponent: (el) => {
22655
- return (el.tagName === "DIV" &&
22656
- (el.getAttribute("data-scale") === "true" ||
22657
- el.classList.contains("scale")));
22655
+ return (el.tagName === 'DIV' &&
22656
+ (el.getAttribute('data-scale') === 'true' ||
22657
+ el.classList.contains('scale')));
22658
22658
  },
22659
22659
  model: {
22660
22660
  defaults: {
22661
- tagName: "div",
22661
+ tagName: 'div',
22662
22662
  attributes: {
22663
- "data-scale": "true",
22664
- "data-percent": "66",
22665
- "data-fcolor": "#3b5998",
22666
- "data-bgcolor": "#CCCCCC",
22667
- "aria-label": "66 %",
22668
- role: "img",
22663
+ 'data-scale': 'true',
22664
+ 'data-percent': '66',
22665
+ 'data-fcolor': '#3b5998',
22666
+ 'data-bgcolor': '#CCCCCC',
22667
+ 'aria-label': '66 %',
22668
+ role: 'img',
22669
22669
  },
22670
22670
  style: {
22671
- "box-sizing": "border-box",
22672
- padding: "0",
22673
- height: "20px",
22674
- "max-width": "100%",
22675
- border: "0px solid #666666",
22676
- background: "linear-gradient(to right, #3b5998 66%, #CCCCCC 66%)",
22671
+ 'box-sizing': 'border-box',
22672
+ 'height': '20px',
22673
+ 'max-width': '100%',
22674
+ 'background': 'linear-gradient(to right, #3b5998 66%, #CCCCCC 66%)',
22677
22675
  },
22678
22676
  traits: [
22677
+ 'id',
22679
22678
  {
22680
- name: "percent",
22681
- type: "number",
22679
+ name: 'percent',
22680
+ type: 'number',
22682
22681
  min: 0,
22683
22682
  max: 100,
22684
22683
  label: opts.t9n.labelScalePercent,
22685
22684
  changeProp: true,
22686
22685
  },
22687
22686
  {
22688
- name: "fcolor",
22689
- type: "color",
22687
+ name: 'fcolor',
22688
+ type: 'color',
22690
22689
  label: opts.t9n.labelScaleBarColor,
22691
- placeholder: "#222222",
22690
+ placeholder: '#222222',
22692
22691
  changeProp: true,
22693
22692
  },
22694
22693
  {
22695
- name: "bgcolor",
22696
- type: "color",
22694
+ name: 'bgcolor',
22695
+ type: 'color',
22697
22696
  label: opts.t9n.labelScaleBgColor,
22698
- placeholder: "#cccccc",
22697
+ placeholder: '#cccccc',
22699
22698
  changeProp: true,
22700
22699
  },
22701
22700
  (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeHideInSimpleHtmlTrait)(opts),
22702
22701
  ],
22703
22702
  },
22704
22703
  init() {
22705
- var _a;
22706
22704
  const attr = this.getAttributes();
22707
- const el = (_a = this.view) === null || _a === void 0 ? void 0 : _a.el;
22708
- let p = parseInt(attr["data-percent"]);
22709
- let f = attr["data-fcolor"];
22710
- let b = attr["data-bgcolor"];
22705
+ let p = parseInt(attr['data-percent']);
22706
+ let f = attr['data-fcolor'];
22707
+ let b = attr['data-bgcolor'];
22711
22708
  if (isNaN(p))
22712
22709
  p = 66;
22713
22710
  if (!f)
22714
- f = "#3b5998";
22711
+ f = '#3b5998';
22715
22712
  if (!b)
22716
- b = "#CCCCCC";
22717
- this.set("percent", Math.max(0, Math.min(100, p)));
22718
- this.set("bgcolor", b);
22719
- this.set("fcolor", f);
22720
- this.on("change:percent", this.updateScale);
22721
- this.on("change:bgcolor", this.updateScale);
22722
- this.on("change:fcolor", this.updateScale);
22713
+ b = '#CCCCCC';
22714
+ p = Math.max(0, Math.min(100, p));
22715
+ this.set('percent', p, { silent: true });
22716
+ this.set('bgcolor', b, { silent: true });
22717
+ this.set('fcolor', f, { silent: true });
22718
+ // Clean up stale background properties from saved HTML
22719
+ this.cleanupBackgroundStyles();
22720
+ const update = () => this.updateScale();
22721
+ this.on('change:percent', update);
22722
+ this.on('change:bgcolor', update);
22723
+ this.on('change:fcolor', update);
22724
+ },
22725
+ onRender() {
22726
+ this.updateScale();
22727
+ },
22728
+ cleanupBackgroundStyles() {
22729
+ const styles = this.getStyle() || {};
22730
+ // Remove stale background-image that conflicts with gradient
22731
+ delete styles['background-image'];
22732
+ delete styles['background-position-x'];
22733
+ delete styles['background-position-y'];
22734
+ delete styles['background-size'];
22735
+ delete styles['background-repeat'];
22736
+ delete styles['background-attachment'];
22737
+ delete styles['background-origin'];
22738
+ delete styles['background-clip'];
22739
+ delete styles['background-color'];
22740
+ this.setStyle(styles, { silent: true });
22723
22741
  },
22724
22742
  updateScale() {
22725
- let p = parseInt(this.get("percent"));
22726
- const f = this.get("fcolor") || "#3b5998";
22727
- const b = this.get("bgcolor") || "#CCCCCC";
22728
- if (isNaN(p))
22729
- p = 0;
22730
- p = Math.max(0, Math.min(100, p));
22731
- this.set("attributes", {
22732
- "data-scale": "true",
22733
- "data-percent": p,
22734
- "data-fcolor": f,
22735
- "data-bgcolor": b,
22736
- "aria-label": `${p} %`,
22737
- });
22738
- this.addStyle({
22739
- background: `linear-gradient(to right, ${f} ${p}%, ${b} ${p}%)`,
22740
- });
22743
+ try {
22744
+ let p = parseInt(this.get('percent'));
22745
+ const f = this.get('fcolor') || '#3b5998';
22746
+ const b = this.get('bgcolor') || '#CCCCCC';
22747
+ if (isNaN(p))
22748
+ p = 0;
22749
+ p = Math.max(0, Math.min(100, p));
22750
+ this.setAttributes({
22751
+ 'data-scale': 'true',
22752
+ 'data-percent': p.toString(),
22753
+ 'data-fcolor': f,
22754
+ 'data-bgcolor': b,
22755
+ 'aria-label': `${p} %`,
22756
+ }, { silent: true });
22757
+ const styles = this.getStyle() || {};
22758
+ // Apply gradient with validated colors
22759
+ styles['background'] = `linear-gradient(to right, ${f} ${p}%, ${b} ${p}%)`;
22760
+ this.setStyle(styles);
22761
+ }
22762
+ catch (error) {
22763
+ console.warn('Scale component update failed:', error);
22764
+ }
22741
22765
  },
22742
22766
  },
22743
22767
  });
22744
22768
  // INPUT
22745
- DomComponents.addType("range", {
22746
- isComponent: (el) => el.tagName == "INPUT",
22769
+ DomComponents.addType('range', {
22770
+ isComponent: (el) => el.tagName == 'INPUT',
22747
22771
  model: {
22748
22772
  defaults: {
22749
- tagName: "input",
22773
+ tagName: 'input',
22750
22774
  droppable: true,
22751
22775
  highlightable: true,
22752
22776
  traits: [_consts__WEBPACK_IMPORTED_MODULE_0__.nameTrait, _consts__WEBPACK_IMPORTED_MODULE_0__.valueTrait],
22753
- attributes: { type: "range", disabled: true },
22777
+ attributes: { type: 'range', disabled: true },
22754
22778
  },
22755
22779
  },
22756
- extendFnView: ["updateAttributes"],
22780
+ extendFnView: ['updateAttributes'],
22757
22781
  view: {
22758
22782
  updateAttributes() {
22759
- this.el.setAttribute("autocomplete", "on");
22783
+ this.el.setAttribute('autocomplete', 'on');
22760
22784
  },
22761
22785
  },
22762
22786
  });
22763
22787
  // Unsorted list item component
22764
- DomComponents.addType("ulistitem", {
22788
+ DomComponents.addType('ulistitem', {
22765
22789
  isComponent: (el) => {
22766
- if (el.tagName === "LI" && el.classList.contains("ulistitem")) {
22767
- return { type: "ulistitem" };
22790
+ if (el.tagName === 'LI' && el.classList.contains('ulistitem')) {
22791
+ return { type: 'ulistitem' };
22768
22792
  }
22769
22793
  },
22770
22794
  model: {
22771
22795
  defaults: {
22772
- tagName: "li",
22773
- draggable: "ul",
22774
- attributes: { class: "ulistitem" },
22775
- style: { "text-align": "left" },
22796
+ tagName: 'li',
22797
+ draggable: 'ul',
22798
+ attributes: { class: 'ulistitem' },
22799
+ style: { 'text-align': 'left' },
22776
22800
  components: _consts__WEBPACK_IMPORTED_MODULE_0__.uListItemContent,
22777
- traits: ["id", "title", (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeTextTrait)(opts)],
22801
+ traits: ['id', 'title', (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeTextTrait)(opts)],
22778
22802
  },
22779
22803
  },
22780
22804
  });
22781
22805
  // Unsorted list component with fontawesome
22782
- DomComponents.addType("ulist", {
22806
+ DomComponents.addType('ulist', {
22783
22807
  isComponent: (el) => {
22784
- if (el.tagName === "UL" && el.classList.contains("ulist")) {
22785
- return { type: "ulist" };
22808
+ if (el.tagName === 'UL' && el.classList.contains('ulist')) {
22809
+ return { type: 'ulist' };
22786
22810
  }
22787
22811
  },
22788
22812
  model: {
22789
22813
  defaults: {
22790
- tagName: "ul",
22791
- attributes: { class: "ulist fa-ul" },
22814
+ tagName: 'ul',
22815
+ attributes: { class: 'ulist fa-ul' },
22792
22816
  style: {
22793
- padding: "0.2em 0",
22794
- "margin-left": "2em",
22795
- "line-height": "1.4em",
22817
+ padding: '0.2em 0',
22818
+ 'margin-left': '2em',
22819
+ 'line-height': '1.4em',
22796
22820
  },
22797
22821
  components: [_consts__WEBPACK_IMPORTED_MODULE_0__.ulListItem, _consts__WEBPACK_IMPORTED_MODULE_0__.ulListItem, _consts__WEBPACK_IMPORTED_MODULE_0__.ulListItem],
22798
22822
  traits: [
22799
- "id",
22823
+ 'id',
22800
22824
  (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeTextTrait)(opts),
22801
22825
  (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeHideInSimpleHtmlTrait)(opts),
22802
22826
  ],
@@ -22804,19 +22828,19 @@ __webpack_require__.r(__webpack_exports__);
22804
22828
  },
22805
22829
  });
22806
22830
  // Header component
22807
- DomComponents.addType("header", {
22831
+ DomComponents.addType('header', {
22808
22832
  isComponent: (el) => {
22809
- const headings = ["h1", "h2", "h3", "h4", "h5", "h6"];
22833
+ const headings = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
22810
22834
  if (el.tagName && headings.includes(el.tagName.toLowerCase())) {
22811
- return { type: "header" };
22835
+ return { type: 'header' };
22812
22836
  }
22813
22837
  },
22814
- extend: "text",
22838
+ extend: 'text',
22815
22839
  model: {
22816
22840
  defaults: {
22817
- tagName: "h1", //Default
22841
+ tagName: 'h1', //Default
22818
22842
  traits: [
22819
- "id",
22843
+ 'id',
22820
22844
  (0,_consts__WEBPACK_IMPORTED_MODULE_0__.headerTrait)(opts),
22821
22845
  (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeTextTrait)(opts),
22822
22846
  (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeHideInSimpleHtmlTrait)(opts),
@@ -22825,36 +22849,36 @@ __webpack_require__.r(__webpack_exports__);
22825
22849
  },
22826
22850
  });
22827
22851
  // Icon component
22828
- DomComponents.addType("icon", {
22852
+ DomComponents.addType('icon', {
22829
22853
  isComponent: (el) => {
22830
22854
  var classNames = [
22831
- "fa",
22832
- "fas",
22833
- "far",
22834
- "fab",
22835
- "fa-solid",
22836
- "fa-regular",
22837
- "fa-brands",
22855
+ 'fa',
22856
+ 'fas',
22857
+ 'far',
22858
+ 'fab',
22859
+ 'fa-solid',
22860
+ 'fa-regular',
22861
+ 'fa-brands',
22838
22862
  ];
22839
- if (el.tagName === "I" &&
22863
+ if (el.tagName === 'I' &&
22840
22864
  classNames.some((className) => el.classList.contains(className))) {
22841
- return { type: "icon" };
22865
+ return { type: 'icon' };
22842
22866
  }
22843
22867
  },
22844
22868
  model: {
22845
22869
  defaults: {
22846
- tagName: "i",
22847
- attributes: { class: "fas fa-star" },
22848
- traits: ["id", (0,_consts__WEBPACK_IMPORTED_MODULE_0__.iconTrait)(opts), (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeHideInSimpleHtmlTrait)(opts)],
22870
+ tagName: 'i',
22871
+ attributes: { class: 'fas fa-star' },
22872
+ traits: ['id', (0,_consts__WEBPACK_IMPORTED_MODULE_0__.iconTrait)(opts), (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeHideInSimpleHtmlTrait)(opts)],
22849
22873
  },
22850
22874
  },
22851
22875
  });
22852
22876
  // Add ostendis type trait to table components
22853
- DomComponents.addType("table", {
22877
+ DomComponents.addType('table', {
22854
22878
  model: {
22855
22879
  defaults: {
22856
22880
  traits: [
22857
- "id",
22881
+ 'id',
22858
22882
  (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeTextTrait)(opts),
22859
22883
  (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeHideInSimpleHtmlTrait)(opts),
22860
22884
  ],
@@ -22862,13 +22886,13 @@ __webpack_require__.r(__webpack_exports__);
22862
22886
  },
22863
22887
  });
22864
22888
  // Add ostendis type trait to link components
22865
- DomComponents.addType("link", {
22889
+ DomComponents.addType('link', {
22866
22890
  model: {
22867
22891
  defaults: {
22868
22892
  traits: [
22869
- "id",
22870
- "href",
22871
- "target",
22893
+ 'id',
22894
+ 'href',
22895
+ 'target',
22872
22896
  (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeTextTrait)(opts),
22873
22897
  (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeHideInSimpleHtmlTrait)(opts),
22874
22898
  ],
@@ -22876,12 +22900,12 @@ __webpack_require__.r(__webpack_exports__);
22876
22900
  },
22877
22901
  });
22878
22902
  // Add ostendis type trait to image components
22879
- DomComponents.addType("image", {
22903
+ DomComponents.addType('image', {
22880
22904
  model: {
22881
22905
  defaults: {
22882
22906
  traits: [
22883
- "id",
22884
- "alt",
22907
+ 'id',
22908
+ 'alt',
22885
22909
  (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeImageTrait)(opts),
22886
22910
  (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeHideInSimpleHtmlTrait)(opts),
22887
22911
  ],
@@ -22889,11 +22913,11 @@ __webpack_require__.r(__webpack_exports__);
22889
22913
  },
22890
22914
  });
22891
22915
  // Add ostendis type trait to text components
22892
- DomComponents.addType("textnode", {
22916
+ DomComponents.addType('textnode', {
22893
22917
  model: {
22894
22918
  defaults: {
22895
22919
  traits: [
22896
- "id",
22920
+ 'id',
22897
22921
  (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeTextTrait)(opts),
22898
22922
  (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeHideInSimpleHtmlTrait)(opts),
22899
22923
  ],
@@ -22901,11 +22925,11 @@ __webpack_require__.r(__webpack_exports__);
22901
22925
  },
22902
22926
  });
22903
22927
  // Add ostendis type trait to text components
22904
- DomComponents.addType("text", {
22928
+ DomComponents.addType('text', {
22905
22929
  model: {
22906
22930
  defaults: {
22907
22931
  traits: [
22908
- "id",
22932
+ 'id',
22909
22933
  (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeTextTrait)(opts),
22910
22934
  (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeHideInSimpleHtmlTrait)(opts),
22911
22935
  ],
@@ -22913,11 +22937,11 @@ __webpack_require__.r(__webpack_exports__);
22913
22937
  },
22914
22938
  });
22915
22939
  // Add ostendis type trait to default components
22916
- DomComponents.addType("default", {
22940
+ DomComponents.addType('default', {
22917
22941
  model: {
22918
22942
  defaults: {
22919
22943
  traits: [
22920
- "id",
22944
+ 'id',
22921
22945
  (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeTextTrait)(opts),
22922
22946
  (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeHideInSimpleHtmlTrait)(opts),
22923
22947
  ],
@@ -22984,9 +23008,7 @@ const uListItemContent = [
22984
23008
  },
22985
23009
  {
22986
23010
  type: "text",
22987
- tagName: "p",
22988
23011
  content: "Text",
22989
- style: { margin: "0", padding: "0", "text-align": "left" },
22990
23012
  },
22991
23013
  ];
22992
23014
  const ulListItem = {