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

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,188 @@ __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
+ padding: '0',
22673
+ height: '20px',
22674
+ 'max-width': '100%',
22675
+ border: '0px solid #666666',
22676
+ background: 'linear-gradient(to right, #3b5998 66%, #CCCCCC 66%)',
22677
22677
  },
22678
22678
  traits: [
22679
22679
  {
22680
- name: "percent",
22681
- type: "number",
22680
+ name: 'percent',
22681
+ type: 'number',
22682
22682
  min: 0,
22683
22683
  max: 100,
22684
22684
  label: opts.t9n.labelScalePercent,
22685
22685
  changeProp: true,
22686
22686
  },
22687
22687
  {
22688
- name: "fcolor",
22689
- type: "color",
22688
+ name: 'fcolor',
22689
+ type: 'color',
22690
22690
  label: opts.t9n.labelScaleBarColor,
22691
- placeholder: "#222222",
22691
+ placeholder: '#222222',
22692
22692
  changeProp: true,
22693
22693
  },
22694
22694
  {
22695
- name: "bgcolor",
22696
- type: "color",
22695
+ name: 'bgcolor',
22696
+ type: 'color',
22697
22697
  label: opts.t9n.labelScaleBgColor,
22698
- placeholder: "#cccccc",
22698
+ placeholder: '#cccccc',
22699
22699
  changeProp: true,
22700
22700
  },
22701
22701
  (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeHideInSimpleHtmlTrait)(opts),
22702
22702
  ],
22703
22703
  },
22704
22704
  init() {
22705
- var _a;
22706
22705
  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"];
22706
+ let p = parseInt(attr['data-percent']);
22707
+ let f = attr['data-fcolor'];
22708
+ let b = attr['data-bgcolor'];
22711
22709
  if (isNaN(p))
22712
22710
  p = 66;
22713
22711
  if (!f)
22714
- f = "#3b5998";
22712
+ f = '#3b5998';
22715
22713
  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);
22714
+ b = '#CCCCCC';
22715
+ p = Math.max(0, Math.min(100, p));
22716
+ this.set('percent', p, { silent: true });
22717
+ this.set('bgcolor', b, { silent: true });
22718
+ this.set('fcolor', f, { silent: true });
22719
+ const update = () => this.updateScale();
22720
+ this.on('change:percent', update);
22721
+ this.on('change:bgcolor', update);
22722
+ this.on('change:fcolor', update);
22723
+ },
22724
+ onRender() {
22725
+ this.updateScale();
22723
22726
  },
22724
22727
  updateScale() {
22725
- let p = parseInt(this.get("percent"));
22726
- const f = this.get("fcolor") || "#3b5998";
22727
- const b = this.get("bgcolor") || "#CCCCCC";
22728
+ let p = parseInt(this.get('percent'));
22729
+ const f = this.get('fcolor') || '#3b5998';
22730
+ const b = this.get('bgcolor') || '#CCCCCC';
22728
22731
  if (isNaN(p))
22729
22732
  p = 0;
22730
22733
  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
- });
22734
+ this.setAttributes({
22735
+ 'data-scale': 'true',
22736
+ 'data-percent': p.toString(),
22737
+ 'data-fcolor': f,
22738
+ 'data-bgcolor': b,
22739
+ 'aria-label': `${p} %`,
22740
+ }, { silent: true });
22741
+ const styles = this.getStyle() || {};
22742
+ // Remove conflicting background properties from saved HTML
22743
+ [
22744
+ 'background-image',
22745
+ 'background-position-x',
22746
+ 'background-position-y',
22747
+ 'background-size',
22748
+ 'background-repeat',
22749
+ 'background-attachment',
22750
+ 'background-origin',
22751
+ 'background-clip',
22752
+ 'background-color',
22753
+ ].forEach((prop) => delete styles[prop]);
22754
+ styles['background'] = `linear-gradient(to right, ${f} ${p}%, ${b} ${p}%)`;
22755
+ this.setStyle(styles);
22741
22756
  },
22742
22757
  },
22743
22758
  });
22744
22759
  // INPUT
22745
- DomComponents.addType("range", {
22746
- isComponent: (el) => el.tagName == "INPUT",
22760
+ DomComponents.addType('range', {
22761
+ isComponent: (el) => el.tagName == 'INPUT',
22747
22762
  model: {
22748
22763
  defaults: {
22749
- tagName: "input",
22764
+ tagName: 'input',
22750
22765
  droppable: true,
22751
22766
  highlightable: true,
22752
22767
  traits: [_consts__WEBPACK_IMPORTED_MODULE_0__.nameTrait, _consts__WEBPACK_IMPORTED_MODULE_0__.valueTrait],
22753
- attributes: { type: "range", disabled: true },
22768
+ attributes: { type: 'range', disabled: true },
22754
22769
  },
22755
22770
  },
22756
- extendFnView: ["updateAttributes"],
22771
+ extendFnView: ['updateAttributes'],
22757
22772
  view: {
22758
22773
  updateAttributes() {
22759
- this.el.setAttribute("autocomplete", "on");
22774
+ this.el.setAttribute('autocomplete', 'on');
22760
22775
  },
22761
22776
  },
22762
22777
  });
22763
22778
  // Unsorted list item component
22764
- DomComponents.addType("ulistitem", {
22779
+ DomComponents.addType('ulistitem', {
22765
22780
  isComponent: (el) => {
22766
- if (el.tagName === "LI" && el.classList.contains("ulistitem")) {
22767
- return { type: "ulistitem" };
22781
+ if (el.tagName === 'LI' && el.classList.contains('ulistitem')) {
22782
+ return { type: 'ulistitem' };
22768
22783
  }
22769
22784
  },
22770
22785
  model: {
22771
22786
  defaults: {
22772
- tagName: "li",
22773
- draggable: "ul",
22774
- attributes: { class: "ulistitem" },
22775
- style: { "text-align": "left" },
22787
+ tagName: 'li',
22788
+ draggable: 'ul',
22789
+ attributes: { class: 'ulistitem' },
22790
+ style: { 'text-align': 'left' },
22776
22791
  components: _consts__WEBPACK_IMPORTED_MODULE_0__.uListItemContent,
22777
- traits: ["id", "title", (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeTextTrait)(opts)],
22792
+ traits: ['id', 'title', (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeTextTrait)(opts)],
22778
22793
  },
22779
22794
  },
22780
22795
  });
22781
22796
  // Unsorted list component with fontawesome
22782
- DomComponents.addType("ulist", {
22797
+ DomComponents.addType('ulist', {
22783
22798
  isComponent: (el) => {
22784
- if (el.tagName === "UL" && el.classList.contains("ulist")) {
22785
- return { type: "ulist" };
22799
+ if (el.tagName === 'UL' && el.classList.contains('ulist')) {
22800
+ return { type: 'ulist' };
22786
22801
  }
22787
22802
  },
22788
22803
  model: {
22789
22804
  defaults: {
22790
- tagName: "ul",
22791
- attributes: { class: "ulist fa-ul" },
22805
+ tagName: 'ul',
22806
+ attributes: { class: 'ulist fa-ul' },
22792
22807
  style: {
22793
- padding: "0.2em 0",
22794
- "margin-left": "2em",
22795
- "line-height": "1.4em",
22808
+ padding: '0.2em 0',
22809
+ 'margin-left': '2em',
22810
+ 'line-height': '1.4em',
22796
22811
  },
22797
22812
  components: [_consts__WEBPACK_IMPORTED_MODULE_0__.ulListItem, _consts__WEBPACK_IMPORTED_MODULE_0__.ulListItem, _consts__WEBPACK_IMPORTED_MODULE_0__.ulListItem],
22798
22813
  traits: [
22799
- "id",
22814
+ 'id',
22800
22815
  (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeTextTrait)(opts),
22801
22816
  (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeHideInSimpleHtmlTrait)(opts),
22802
22817
  ],
@@ -22804,19 +22819,19 @@ __webpack_require__.r(__webpack_exports__);
22804
22819
  },
22805
22820
  });
22806
22821
  // Header component
22807
- DomComponents.addType("header", {
22822
+ DomComponents.addType('header', {
22808
22823
  isComponent: (el) => {
22809
- const headings = ["h1", "h2", "h3", "h4", "h5", "h6"];
22824
+ const headings = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
22810
22825
  if (el.tagName && headings.includes(el.tagName.toLowerCase())) {
22811
- return { type: "header" };
22826
+ return { type: 'header' };
22812
22827
  }
22813
22828
  },
22814
- extend: "text",
22829
+ extend: 'text',
22815
22830
  model: {
22816
22831
  defaults: {
22817
- tagName: "h1", //Default
22832
+ tagName: 'h1', //Default
22818
22833
  traits: [
22819
- "id",
22834
+ 'id',
22820
22835
  (0,_consts__WEBPACK_IMPORTED_MODULE_0__.headerTrait)(opts),
22821
22836
  (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeTextTrait)(opts),
22822
22837
  (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeHideInSimpleHtmlTrait)(opts),
@@ -22825,36 +22840,36 @@ __webpack_require__.r(__webpack_exports__);
22825
22840
  },
22826
22841
  });
22827
22842
  // Icon component
22828
- DomComponents.addType("icon", {
22843
+ DomComponents.addType('icon', {
22829
22844
  isComponent: (el) => {
22830
22845
  var classNames = [
22831
- "fa",
22832
- "fas",
22833
- "far",
22834
- "fab",
22835
- "fa-solid",
22836
- "fa-regular",
22837
- "fa-brands",
22846
+ 'fa',
22847
+ 'fas',
22848
+ 'far',
22849
+ 'fab',
22850
+ 'fa-solid',
22851
+ 'fa-regular',
22852
+ 'fa-brands',
22838
22853
  ];
22839
- if (el.tagName === "I" &&
22854
+ if (el.tagName === 'I' &&
22840
22855
  classNames.some((className) => el.classList.contains(className))) {
22841
- return { type: "icon" };
22856
+ return { type: 'icon' };
22842
22857
  }
22843
22858
  },
22844
22859
  model: {
22845
22860
  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)],
22861
+ tagName: 'i',
22862
+ attributes: { class: 'fas fa-star' },
22863
+ traits: ['id', (0,_consts__WEBPACK_IMPORTED_MODULE_0__.iconTrait)(opts), (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeHideInSimpleHtmlTrait)(opts)],
22849
22864
  },
22850
22865
  },
22851
22866
  });
22852
22867
  // Add ostendis type trait to table components
22853
- DomComponents.addType("table", {
22868
+ DomComponents.addType('table', {
22854
22869
  model: {
22855
22870
  defaults: {
22856
22871
  traits: [
22857
- "id",
22872
+ 'id',
22858
22873
  (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeTextTrait)(opts),
22859
22874
  (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeHideInSimpleHtmlTrait)(opts),
22860
22875
  ],
@@ -22862,13 +22877,13 @@ __webpack_require__.r(__webpack_exports__);
22862
22877
  },
22863
22878
  });
22864
22879
  // Add ostendis type trait to link components
22865
- DomComponents.addType("link", {
22880
+ DomComponents.addType('link', {
22866
22881
  model: {
22867
22882
  defaults: {
22868
22883
  traits: [
22869
- "id",
22870
- "href",
22871
- "target",
22884
+ 'id',
22885
+ 'href',
22886
+ 'target',
22872
22887
  (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeTextTrait)(opts),
22873
22888
  (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeHideInSimpleHtmlTrait)(opts),
22874
22889
  ],
@@ -22876,12 +22891,12 @@ __webpack_require__.r(__webpack_exports__);
22876
22891
  },
22877
22892
  });
22878
22893
  // Add ostendis type trait to image components
22879
- DomComponents.addType("image", {
22894
+ DomComponents.addType('image', {
22880
22895
  model: {
22881
22896
  defaults: {
22882
22897
  traits: [
22883
- "id",
22884
- "alt",
22898
+ 'id',
22899
+ 'alt',
22885
22900
  (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeImageTrait)(opts),
22886
22901
  (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeHideInSimpleHtmlTrait)(opts),
22887
22902
  ],
@@ -22889,11 +22904,11 @@ __webpack_require__.r(__webpack_exports__);
22889
22904
  },
22890
22905
  });
22891
22906
  // Add ostendis type trait to text components
22892
- DomComponents.addType("textnode", {
22907
+ DomComponents.addType('textnode', {
22893
22908
  model: {
22894
22909
  defaults: {
22895
22910
  traits: [
22896
- "id",
22911
+ 'id',
22897
22912
  (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeTextTrait)(opts),
22898
22913
  (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeHideInSimpleHtmlTrait)(opts),
22899
22914
  ],
@@ -22901,11 +22916,11 @@ __webpack_require__.r(__webpack_exports__);
22901
22916
  },
22902
22917
  });
22903
22918
  // Add ostendis type trait to text components
22904
- DomComponents.addType("text", {
22919
+ DomComponents.addType('text', {
22905
22920
  model: {
22906
22921
  defaults: {
22907
22922
  traits: [
22908
- "id",
22923
+ 'id',
22909
22924
  (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeTextTrait)(opts),
22910
22925
  (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeHideInSimpleHtmlTrait)(opts),
22911
22926
  ],
@@ -22913,11 +22928,11 @@ __webpack_require__.r(__webpack_exports__);
22913
22928
  },
22914
22929
  });
22915
22930
  // Add ostendis type trait to default components
22916
- DomComponents.addType("default", {
22931
+ DomComponents.addType('default', {
22917
22932
  model: {
22918
22933
  defaults: {
22919
22934
  traits: [
22920
- "id",
22935
+ 'id',
22921
22936
  (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeTextTrait)(opts),
22922
22937
  (0,_consts__WEBPACK_IMPORTED_MODULE_0__.ostTypeHideInSimpleHtmlTrait)(opts),
22923
22938
  ],
@@ -22984,9 +22999,7 @@ const uListItemContent = [
22984
22999
  },
22985
23000
  {
22986
23001
  type: "text",
22987
- tagName: "p",
22988
23002
  content: "Text",
22989
- style: { margin: "0", padding: "0", "text-align": "left" },
22990
23003
  },
22991
23004
  ];
22992
23005
  const ulListItem = {