@bbl-digital/snorre 4.0.96 → 4.0.97

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.
package/dist/bundle.js CHANGED
@@ -1673,7 +1673,7 @@
1673
1673
  const setDisabled = theme => /*#__PURE__*/react.css("color:", theme.btnDisabled, ";text-decoration:none;" + (process.env.NODE_ENV === "production" ? "" : ";label:setDisabled;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9wYWNrYWdlcy9jb3JlL0xpbmsvc3R5bGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQXdFb0QiLCJmaWxlIjoiLi4vLi4vLi4vc3JjL3BhY2thZ2VzL2NvcmUvTGluay9zdHlsZXMudHMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCdcbmltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0J1xuaW1wb3J0IHsgSUFwcFRoZW1lIH0gZnJvbSAnLi4vLi4vYXBwLXNoZWxsL3RoZW1lJ1xuXG5leHBvcnQgY29uc3QgSWNvbkxpbmtXcmFwcGVyID0gc3R5bGVkLnNwYW5gXG4gIGRpc3BsYXk6IGZsZXg7XG4gIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG5gXG5cbmV4cG9ydCBjb25zdCBOb1N0eWxlID0gY3NzYFxuICBjb2xvcjogaW5oZXJpdDtcbiAgZm9udC1zaXplOiBpbmhlcml0O1xuICBmb250LXdlaWdodDogaW5oZXJpdDtcbiAgdGV4dC1kZWNvcmF0aW9uOiBub25lO1xuICBsaW5lLWhlaWdodDogaW5oZXJpdDtcbiAgYmFja2dyb3VuZC1jb2xvcjogdHJhbnNwYXJlbnQ7XG4gIGJvcmRlcjogbm9uZTtcbmBcblxuZXhwb3J0IGNvbnN0IExpbmtTdHlsZSA9IGNzc2BcbiAgYmFja2dyb3VuZDogbm9uZTtcbiAgYm9yZGVyOiBub25lO1xuICBvdXRsaW5lOiBub25lO1xuICBjb2xvcjogIzE2NTdlMjtcbiAgZm9udC1zaXplOiAxNnB4O1xuICBmb250LXdlaWdodDogNjAwO1xuICBsZXR0ZXItc3BhY2luZzogMDtcbiAgbGluZS1oZWlnaHQ6IDIwcHg7XG4gIHRleHQtZGVjb3JhdGlvbjogdW5kZXJsaW5lO1xuICBjdXJzb3I6IHBvaW50ZXI7XG5cbiAgJjpob3ZlcixcbiAgJjpmb2N1cyxcbiAgJjphY3RpdmUge1xuICAgIHRleHQtZGVjb3JhdGlvbjogbm9uZTtcbiAgfVxuXG4gICY6Zm9jdXMtdmlzaWJsZSB7XG4gICAgb3V0bGluZTogMXB4IGRvdHRlZCAjMjEyMTIxO1xuICAgIG91dGxpbmU6IDVweCBhdXRvIC13ZWJraXQtZm9jdXMtcmluZy1jb2xvcjtcbiAgfVxuYFxuXG5leHBvcnQgY29uc3QgZGFuZ2VyU3R5bGVzID0gKHRoZW1lOiBJQXBwVGhlbWUpID0+IGNzc2BcbiAgY29sb3I6ICR7dGhlbWUuYnRuRGFuZ2VyfTtcbmBcblxuZXhwb3J0IGNvbnN0IG5vUGFkZGluZyA9IGNzc2BcbiAgcGFkZGluZzogMDtcbmBcblxuZXhwb3J0IGNvbnN0IHNldEFsaWduID0gKGFsaWduOiBzdHJpbmcpID0+IGNzc2BcbiAgdGV4dC1hbGlnbjogJHthbGlnbn07XG5gXG5cbmV4cG9ydCBjb25zdCBzbWFsbFRleHQgPSBjc3NgXG4gIGZvbnQtc2l6ZTogMTRweDtcbmBcblxuZXhwb3J0IGNvbnN0IHVuZGVybGluZU5vbmUgPSBjc3NgXG4gIHRleHQtZGVjb3JhdGlvbjogbm9uZTtcblxuICAmOmhvdmVyLFxuICAmOmZvY3VzIHtcbiAgICB0ZXh0LWRlY29yYXRpb246IHVuZGVybGluZTtcbiAgfVxuYFxuXG5leHBvcnQgY29uc3Qgc2V0V29yZEJyZWFrID0gKHZhbHVlOiBzdHJpbmcpID0+IGNzc2BcbiAgd29yZC1icmVhazogJHt2YWx1ZX07XG5gXG5cbmV4cG9ydCBjb25zdCBzZXREaXNhYmxlZCA9ICh0aGVtZTogSUFwcFRoZW1lKSA9PiBjc3NgXG4gIGNvbG9yOiAke3RoZW1lLmJ0bkRpc2FibGVkfTtcbiAgdGV4dC1kZWNvcmF0aW9uOiBub25lO1xuYFxuIl19 */");
1674
1674
 
1675
1675
  /** @jsxImportSource @emotion/react */
1676
- const Link = props => {
1676
+ const Link$1 = props => {
1677
1677
  const {
1678
1678
  disabled,
1679
1679
  children,
@@ -2117,7 +2117,7 @@
2117
2117
  };
2118
2118
 
2119
2119
  function _EMOTION_STRINGIFIED_CSS_ERROR__$15() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
2120
- const Wrapper$B = /*#__PURE__*/_styled__default["default"](Link, process.env.NODE_ENV === "production" ? {
2120
+ const Wrapper$B = /*#__PURE__*/_styled__default["default"](Link$1, process.env.NODE_ENV === "production" ? {
2121
2121
  target: "e17wos1x0"
2122
2122
  } : {
2123
2123
  target: "e17wos1x0",
@@ -2146,7 +2146,7 @@
2146
2146
  };
2147
2147
 
2148
2148
  function _EMOTION_STRINGIFIED_CSS_ERROR__$14() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
2149
- const Wrapper$A = /*#__PURE__*/_styled__default["default"](Link, process.env.NODE_ENV === "production" ? {
2149
+ const Wrapper$A = /*#__PURE__*/_styled__default["default"](Link$1, process.env.NODE_ENV === "production" ? {
2150
2150
  target: "ejgzy2n0"
2151
2151
  } : {
2152
2152
  target: "ejgzy2n0",
@@ -25646,7 +25646,7 @@
25646
25646
  onClick,
25647
25647
  children
25648
25648
  }) => {
25649
- return jsxRuntime.jsx(Link, {
25649
+ return jsxRuntime.jsx(Link$1, {
25650
25650
  trackingName: "Topbar",
25651
25651
  trackingEvent: 'Usermenu click: ' + (children ? children : ''),
25652
25652
  css: theme => [userMenuOption(theme)],
@@ -28349,7 +28349,7 @@
28349
28349
  };
28350
28350
 
28351
28351
  function _EMOTION_STRINGIFIED_CSS_ERROR__$I() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
28352
- const Wrapper$o = /*#__PURE__*/_styled__default["default"](Link, process.env.NODE_ENV === "production" ? {
28352
+ const Wrapper$o = /*#__PURE__*/_styled__default["default"](Link$1, process.env.NODE_ENV === "production" ? {
28353
28353
  shouldForwardProp: pro => pro !== 'isLightTheme',
28354
28354
  target: "eerewvt2"
28355
28355
  } : {
@@ -28541,7 +28541,7 @@
28541
28541
  };
28542
28542
 
28543
28543
  function _EMOTION_STRINGIFIED_CSS_ERROR__$G() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
28544
- const StyledLink = /*#__PURE__*/_styled__default["default"](Link, process.env.NODE_ENV === "production" ? {
28544
+ const StyledLink = /*#__PURE__*/_styled__default["default"](Link$1, process.env.NODE_ENV === "production" ? {
28545
28545
  target: "e12msqxg2"
28546
28546
  } : {
28547
28547
  target: "e12msqxg2",
@@ -28651,7 +28651,7 @@
28651
28651
  });
28652
28652
  };
28653
28653
 
28654
- const Wrapper$k = /*#__PURE__*/_styled__default["default"](Link, process.env.NODE_ENV === "production" ? {
28654
+ const Wrapper$k = /*#__PURE__*/_styled__default["default"](Link$1, process.env.NODE_ENV === "production" ? {
28655
28655
  target: "e1s7qlfe0"
28656
28656
  } : {
28657
28657
  target: "e1s7qlfe0",
@@ -31500,7 +31500,7 @@
31500
31500
  onClick,
31501
31501
  children
31502
31502
  }) => {
31503
- return jsxRuntime.jsxs(Link, {
31503
+ return jsxRuntime.jsxs(Link$1, {
31504
31504
  role: "menuitem",
31505
31505
  trackingName: "Topbar",
31506
31506
  trackingEvent: 'DropdownMenu click: ' + (children ? children : ''),
@@ -32281,7 +32281,7 @@
32281
32281
  disabled
32282
32282
  }) => onClick ? jsxRuntime.jsx(SelectOption, {
32283
32283
  tabIndex: 0,
32284
- children: jsxRuntime.jsx(Link, {
32284
+ children: jsxRuntime.jsx(Link$1, {
32285
32285
  nopadding: true,
32286
32286
  onClick: onClick,
32287
32287
  children: displayText || value
@@ -32431,7 +32431,7 @@
32431
32431
  indent,
32432
32432
  disabled
32433
32433
  }) => onClick ? jsxRuntime.jsx(SelectLinkWrapper, {
32434
- children: jsxRuntime.jsx(Link, {
32434
+ children: jsxRuntime.jsx(Link$1, {
32435
32435
  nopadding: true,
32436
32436
  small: true,
32437
32437
  onClick: onClick,
@@ -32814,7 +32814,7 @@
32814
32814
  text: open ? notice.bodyHtml : notice.bodyHtml.substring(0, 2000)
32815
32815
  })
32816
32816
  }), !showAllContent && /*#__PURE__*/jsxRuntime$1.jsx(Div, {
32817
- children: /*#__PURE__*/jsxRuntime$1.jsx(Link, {
32817
+ children: /*#__PURE__*/jsxRuntime$1.jsx(Link$1, {
32818
32818
  onClick: () => setOpen(!open),
32819
32819
  children: open ? 'Vis mindre' : 'Les mer'
32820
32820
  })
@@ -33435,7 +33435,7 @@
33435
33435
  css: theme => [styles$6.default(theme), (props.invalid || props.invalidMessage) && styles$6.invalid(theme), props.validation && styles$6.validation, props.onLabelClick && styles$6.clickableLabel, height && styles$6.height(height), css && css],
33436
33436
  children: [jsxRuntime.jsxs("span", {
33437
33437
  css: styles$6.label,
33438
- children: [props.label && (props.onLabelClick ? jsxRuntime.jsx(Link, {
33438
+ children: [props.label && (props.onLabelClick ? jsxRuntime.jsx(Link$1, {
33439
33439
  textAlign: "left",
33440
33440
  removeUnderline: true,
33441
33441
  onClick: props.onLabelClick,
@@ -33780,7 +33780,7 @@ to {top: 100vh;}
33780
33780
  bold: true,
33781
33781
  whiteSpace: "nowrap",
33782
33782
  children: title
33783
- }), isMobile && jsxRuntime.jsx(Link, {
33783
+ }), isMobile && jsxRuntime.jsx(Link$1, {
33784
33784
  removeUnderline: true,
33785
33785
  onClick: handleClose,
33786
33786
  children: "Lukk"
@@ -33795,7 +33795,7 @@ to {top: 100vh;}
33795
33795
  lightGray: true,
33796
33796
  margin: "0.5em"
33797
33797
  }), jsxRuntime.jsxs(ActionButtons, {
33798
- children: [onClear && hasFilters && !isMobile && jsxRuntime.jsx(Link, {
33798
+ children: [onClear && hasFilters && !isMobile && jsxRuntime.jsx(Link$1, {
33799
33799
  onClick: () => {
33800
33800
  onClear();
33801
33801
  if (closeOnClear) handleClose();
@@ -35384,6 +35384,27 @@ to {top: 100vh;}
35384
35384
  }
35385
35385
  }
35386
35386
 
35387
+ const Link = Quill__default["default"].import('formats/link');
35388
+ Link.PROTOCOL_WHITELIST = ['http', 'https', 'mailto', 'tel', 'radar', 'rdar', 'smb', 'sms'];
35389
+ class CustomLinkSanitizer extends Link {
35390
+ static sanitize(url) {
35391
+ // Run default sanitize method from Quill
35392
+ const sanitizedUrl = super.sanitize(url);
35393
+
35394
+ // Not whitelisted URL based on protocol so, let's return `blank`
35395
+ if (!sanitizedUrl || sanitizedUrl === 'about:blank') return sanitizedUrl;
35396
+
35397
+ // Verify if the URL already have a whitelisted protocol
35398
+ const hasWhitelistedProtocol = this.PROTOCOL_WHITELIST.some(function (protocol) {
35399
+ return sanitizedUrl.startsWith(protocol);
35400
+ });
35401
+ if (hasWhitelistedProtocol) return sanitizedUrl;
35402
+
35403
+ // if not, then append only 'http' to not to be a relative URL
35404
+ return `http://${sanitizedUrl}`;
35405
+ }
35406
+ }
35407
+
35387
35408
  /** @jsxImportSource @emotion/react */
35388
35409
  const Parchment = Quill__default["default"].import('parchment');
35389
35410
 
@@ -35427,6 +35448,7 @@ to {top: 100vh;}
35427
35448
  'formats/list': Container,
35428
35449
  'formats/ulist': MyListItem
35429
35450
  });
35451
+ Quill__default["default"].register(CustomLinkSanitizer, true);
35430
35452
  const QuillEditor = ({
35431
35453
  height,
35432
35454
  width,
@@ -35946,7 +35968,7 @@ to {top: 100vh;}
35946
35968
  exports.Key = Key;
35947
35969
  exports.Layout = Layout;
35948
35970
  exports.LayoutShell = LayoutShell;
35949
- exports.Link = Link;
35971
+ exports.Link = Link$1;
35950
35972
  exports.List = List;
35951
35973
  exports.ListItem = ListItem$2;
35952
35974
  exports.ListPager = ListPager;
@@ -0,0 +1,15 @@
1
+ import Quill from 'quill';
2
+ const Parchment = Quill.import('parchment');
3
+ export class IndentAttributor extends Parchment.StyleAttributor {
4
+ constructor(...args) {
5
+ super(...args);
6
+ }
7
+ add(node, value) {
8
+ if (value === 0) {
9
+ this.remove(node);
10
+ return true;
11
+ } else {
12
+ return super.add(node, `${value}em`);
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,21 @@
1
+ import Quill from 'quill';
2
+ const Link = Quill.import('formats/link');
3
+ Link.PROTOCOL_WHITELIST = ['http', 'https', 'mailto', 'tel', 'radar', 'rdar', 'smb', 'sms'];
4
+ export class CustomLinkSanitizer extends Link {
5
+ static sanitize(url) {
6
+ // Run default sanitize method from Quill
7
+ const sanitizedUrl = super.sanitize(url);
8
+
9
+ // Not whitelisted URL based on protocol so, let's return `blank`
10
+ if (!sanitizedUrl || sanitizedUrl === 'about:blank') return sanitizedUrl;
11
+
12
+ // Verify if the URL already have a whitelisted protocol
13
+ const hasWhitelistedProtocol = this.PROTOCOL_WHITELIST.some(function (protocol) {
14
+ return sanitizedUrl.startsWith(protocol);
15
+ });
16
+ if (hasWhitelistedProtocol) return sanitizedUrl;
17
+
18
+ // if not, then append only 'http' to not to be a relative URL
19
+ return `http://${sanitizedUrl}`;
20
+ }
21
+ }
@@ -0,0 +1,20 @@
1
+ import Quill from 'quill';
2
+ const ListContainer = Quill.import('formats/list-container');
3
+ export class MyListContainer extends ListContainer {
4
+ static tagName = ['OL', 'UL'];
5
+ static defaultTag = 'OL';
6
+ static create(value) {
7
+ return document.createElement(this.getTag(value));
8
+ }
9
+ static getTag(val) {
10
+ const map = {
11
+ bullet: 'UL',
12
+ ordered: 'OL'
13
+ };
14
+ return map[val] || this.defaultTag;
15
+ }
16
+ checkMerge() {
17
+ // Only merge if the next list is the same type as this one
18
+ return super.checkMerge() && this.domNode.tagName === this.next?.domNode.tagName;
19
+ }
20
+ }
@@ -0,0 +1,24 @@
1
+ import Quill from 'quill';
2
+ import { MyListContainer } from './ListContainer';
3
+ const ListItem = Quill.import('formats/list');
4
+ class MyListItem extends ListItem {
5
+ static requiredContainer = MyListContainer;
6
+ static register() {
7
+ Quill.register(MyListContainer, true);
8
+ }
9
+ optimize(context) {
10
+ if (this.statics.requiredContainer && !(this.parent instanceof this.statics.requiredContainer)) {
11
+ // Insert the format value (bullet, ordered) into wrap arguments
12
+ this.wrap(this.statics.requiredContainer.blotName, MyListItem.formats(this.domNode));
13
+ }
14
+ super.optimize(context);
15
+ }
16
+ format(name, value) {
17
+ // If the list type is different, wrap this list item in a new MyListContainer of that type
18
+ if (name === ListItem.blotName && value !== MyListItem.formats(this.domNode)) {
19
+ this.wrap(this.statics.requiredContainer.blotName, value);
20
+ }
21
+ super.format(name, value);
22
+ }
23
+ }
24
+ export { MyListItem as default };
@@ -7,9 +7,10 @@ import { ErrorWrapper, Label, styles } from './styles';
7
7
  import Text from '../Text';
8
8
  import IconErrorOutline from '../../icons/General/IconErrorOutline';
9
9
  import { useTheme } from '@emotion/react';
10
- import MyListItem from './Attributors/ListItem';
11
- import { MyListContainer } from './Attributors/ListContainer';
12
- import { IndentAttributor } from './Attributors/IndentAttributor';
10
+ import MyListItem from './classes/ListItem';
11
+ import { IndentAttributor } from './classes/IndentAttributor';
12
+ import { CustomLinkSanitizer } from './classes/LinkSanitizer';
13
+ import { MyListContainer } from './classes/ListContainer';
13
14
  import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
14
15
  const Parchment = Quill.import('parchment');
15
16
 
@@ -53,6 +54,7 @@ Quill.register({
53
54
  'formats/list': Container,
54
55
  'formats/ulist': MyListItem
55
56
  });
57
+ Quill.register(CustomLinkSanitizer, true);
56
58
  const QuillEditor = ({
57
59
  height,
58
60
  width,
@@ -0,0 +1,7 @@
1
+ declare const Parchment: any;
2
+ export declare class IndentAttributor extends Parchment.StyleAttributor {
3
+ constructor(...args: any);
4
+ add(node: any, value: any): any;
5
+ }
6
+ export {};
7
+ //# sourceMappingURL=IndentAttributor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IndentAttributor.d.ts","sourceRoot":"","sources":["../../../../src/packages/core/QuillEditor/classes/IndentAttributor.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,SAAS,EAAgC,GAAG,CAAA;AAClD,qBAAa,gBAAiB,SAAQ,SAAS,CAAC,eAAe;gBACjD,GAAG,IAAI,EAAE,GAAG;IAGxB,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG;CAQ1B"}
@@ -0,0 +1,15 @@
1
+ import Quill from 'quill';
2
+ const Parchment = Quill.import('parchment');
3
+ export class IndentAttributor extends Parchment.StyleAttributor {
4
+ constructor(...args) {
5
+ super(...args);
6
+ }
7
+ add(node, value) {
8
+ if (value === 0) {
9
+ this.remove(node);
10
+ return true;
11
+ } else {
12
+ return super.add(node, `${value}em`);
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,6 @@
1
+ declare const Link: any;
2
+ export declare class CustomLinkSanitizer extends Link {
3
+ static sanitize(url: string): any;
4
+ }
5
+ export {};
6
+ //# sourceMappingURL=LinkSanitizer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LinkSanitizer.d.ts","sourceRoot":"","sources":["../../../../src/packages/core/QuillEditor/classes/LinkSanitizer.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,IAAI,EAAmC,GAAG,CAAA;AAYhD,qBAAa,mBAAoB,SAAQ,IAAI;IAC3C,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,MAAM;CAmB5B"}
@@ -0,0 +1,21 @@
1
+ import Quill from 'quill';
2
+ const Link = Quill.import('formats/link');
3
+ Link.PROTOCOL_WHITELIST = ['http', 'https', 'mailto', 'tel', 'radar', 'rdar', 'smb', 'sms'];
4
+ export class CustomLinkSanitizer extends Link {
5
+ static sanitize(url) {
6
+ // Run default sanitize method from Quill
7
+ const sanitizedUrl = super.sanitize(url);
8
+
9
+ // Not whitelisted URL based on protocol so, let's return `blank`
10
+ if (!sanitizedUrl || sanitizedUrl === 'about:blank') return sanitizedUrl;
11
+
12
+ // Verify if the URL already have a whitelisted protocol
13
+ const hasWhitelistedProtocol = this.PROTOCOL_WHITELIST.some(function (protocol) {
14
+ return sanitizedUrl.startsWith(protocol);
15
+ });
16
+ if (hasWhitelistedProtocol) return sanitizedUrl;
17
+
18
+ // if not, then append only 'http' to not to be a relative URL
19
+ return `http://${sanitizedUrl}`;
20
+ }
21
+ }
@@ -0,0 +1,10 @@
1
+ declare const ListContainer: any;
2
+ export declare class MyListContainer extends ListContainer {
3
+ static tagName: string[];
4
+ static defaultTag: string;
5
+ static create(value: 'bullet' | 'ordered'): HTMLElement;
6
+ static getTag(val: 'bullet' | 'ordered'): string;
7
+ checkMerge(): any;
8
+ }
9
+ export {};
10
+ //# sourceMappingURL=ListContainer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ListContainer.d.ts","sourceRoot":"","sources":["../../../../src/packages/core/QuillEditor/classes/ListContainer.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,aAAa,EAA6C,GAAG,CAAA;AACnE,qBAAa,eAAgB,SAAQ,aAAa;IAChD,MAAM,CAAC,OAAO,WAAe;IAC7B,MAAM,CAAC,UAAU,SAAO;IAExB,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,GAAG,SAAS;IAIzC,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,QAAQ,GAAG,SAAS;IAQvC,UAAU;CAMX"}
@@ -0,0 +1,20 @@
1
+ import Quill from 'quill';
2
+ const ListContainer = Quill.import('formats/list-container');
3
+ export class MyListContainer extends ListContainer {
4
+ static tagName = ['OL', 'UL'];
5
+ static defaultTag = 'OL';
6
+ static create(value) {
7
+ return document.createElement(this.getTag(value));
8
+ }
9
+ static getTag(val) {
10
+ const map = {
11
+ bullet: 'UL',
12
+ ordered: 'OL'
13
+ };
14
+ return map[val] || this.defaultTag;
15
+ }
16
+ checkMerge() {
17
+ // Only merge if the next list is the same type as this one
18
+ return super.checkMerge() && this.domNode.tagName === this.next?.domNode.tagName;
19
+ }
20
+ }
@@ -0,0 +1,10 @@
1
+ import { MyListContainer } from './ListContainer';
2
+ declare const ListItem: any;
3
+ declare class MyListItem extends ListItem {
4
+ static requiredContainer: typeof MyListContainer;
5
+ static register(): void;
6
+ optimize(context: any): void;
7
+ format(name: any, value: any): void;
8
+ }
9
+ export { MyListItem as default };
10
+ //# sourceMappingURL=ListItem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ListItem.d.ts","sourceRoot":"","sources":["../../../../src/packages/core/QuillEditor/classes/ListItem.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD,QAAA,MAAM,QAAQ,EAAmC,GAAG,CAAA;AACpD,cAAM,UAAW,SAAQ,QAAQ;IAC/B,MAAM,CAAC,iBAAiB,yBAAkB;IAE1C,MAAM,CAAC,QAAQ;IAIf,QAAQ,CAAC,OAAO,EAAE,GAAG;IAcrB,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG;CAU7B;AAED,OAAO,EAAE,UAAU,IAAI,OAAO,EAAE,CAAA"}
@@ -0,0 +1,24 @@
1
+ import Quill from 'quill';
2
+ import { MyListContainer } from './ListContainer';
3
+ const ListItem = Quill.import('formats/list');
4
+ class MyListItem extends ListItem {
5
+ static requiredContainer = MyListContainer;
6
+ static register() {
7
+ Quill.register(MyListContainer, true);
8
+ }
9
+ optimize(context) {
10
+ if (this.statics.requiredContainer && !(this.parent instanceof this.statics.requiredContainer)) {
11
+ // Insert the format value (bullet, ordered) into wrap arguments
12
+ this.wrap(this.statics.requiredContainer.blotName, MyListItem.formats(this.domNode));
13
+ }
14
+ super.optimize(context);
15
+ }
16
+ format(name, value) {
17
+ // If the list type is different, wrap this list item in a new MyListContainer of that type
18
+ if (name === ListItem.blotName && value !== MyListItem.formats(this.domNode)) {
19
+ this.wrap(this.statics.requiredContainer.blotName, value);
20
+ }
21
+ super.format(name, value);
22
+ }
23
+ }
24
+ export { MyListItem as default };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packages/core/QuillEditor/index.tsx"],"names":[],"mappings":"AAGA,OAAO,2BAA2B,CAAA;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AA4D3C,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA+L3C,CAAA;AAED,eAAe,WAAW,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packages/core/QuillEditor/index.tsx"],"names":[],"mappings":"AAGA,OAAO,2BAA2B,CAAA;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AA+D3C,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA+L3C,CAAA;AAED,eAAe,WAAW,CAAA"}
@@ -7,9 +7,10 @@ import { ErrorWrapper, Label, styles } from './styles';
7
7
  import Text from '../Text';
8
8
  import IconErrorOutline from '../../icons/General/IconErrorOutline';
9
9
  import { useTheme } from '@emotion/react';
10
- import MyListItem from './Attributors/ListItem';
11
- import { MyListContainer } from './Attributors/ListContainer';
12
- import { IndentAttributor } from './Attributors/IndentAttributor';
10
+ import MyListItem from './classes/ListItem';
11
+ import { IndentAttributor } from './classes/IndentAttributor';
12
+ import { CustomLinkSanitizer } from './classes/LinkSanitizer';
13
+ import { MyListContainer } from './classes/ListContainer';
13
14
  import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
14
15
  const Parchment = Quill.import('parchment');
15
16
 
@@ -53,6 +54,7 @@ Quill.register({
53
54
  'formats/list': Container,
54
55
  'formats/ulist': MyListItem
55
56
  });
57
+ Quill.register(CustomLinkSanitizer, true);
56
58
  const QuillEditor = ({
57
59
  height,
58
60
  width,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbl-digital/snorre",
3
- "version": "4.0.96",
3
+ "version": "4.0.97",
4
4
  "description": "Design library for BBL Digital",
5
5
  "license": "MIT",
6
6
  "main": "./lib/index.js",