@bbl-digital/snorre 4.0.81 → 4.0.83
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/bundle.js +51 -4
- package/esm/core/QuillEditor/Attributors/IndentAttributor.js +2 -3
- package/esm/core/QuillEditor/Attributors/ListContainer.js +19 -0
- package/esm/core/QuillEditor/Attributors/ListItem.js +24 -0
- package/esm/core/QuillEditor/index.js +9 -1
- package/lib/core/QuillEditor/Attributors/IndentAttributor.d.ts +2 -2
- package/lib/core/QuillEditor/Attributors/IndentAttributor.d.ts.map +1 -1
- package/lib/core/QuillEditor/Attributors/IndentAttributor.js +2 -3
- package/lib/core/QuillEditor/Attributors/ListContainer.d.ts +9 -0
- package/lib/core/QuillEditor/Attributors/ListContainer.d.ts.map +1 -0
- package/lib/core/QuillEditor/Attributors/ListContainer.js +19 -0
- package/lib/core/QuillEditor/Attributors/ListItem.d.ts +10 -0
- package/lib/core/QuillEditor/Attributors/ListItem.d.ts.map +1 -0
- package/lib/core/QuillEditor/Attributors/ListItem.js +24 -0
- package/lib/core/QuillEditor/index.d.ts.map +1 -1
- package/lib/core/QuillEditor/index.js +9 -1
- package/package.json +1 -1
package/dist/bundle.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
(function (global, factory) {
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@emotion/styled/base'), require('react'), require('@emotion/react'), require('@emotion/react/jsx-runtime'), require('react/jsx-runtime'), require('react-transition-group'), require('react-player'), require('react-aria'), require('react-quill/dist/quill.snow.css'), require('match-sorter'), require('body-scroll-lock'), require('framer-motion'), require('recharts'), require('nuka-carousel'), require('react-day-picker'), require('date-fns/locale'), require('react-popper'), require('date-fns'), require('react-beautiful-dnd'), require('@tinymce/tinymce-react'), require('react-images-uploading'), require('react-stately'), require('react-quill'), require('quill'), require('quill/dist/quill.snow.css')) :
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@emotion/styled/base', 'react', '@emotion/react', '@emotion/react/jsx-runtime', 'react/jsx-runtime', 'react-transition-group', 'react-player', 'react-aria', 'react-quill/dist/quill.snow.css', 'match-sorter', 'body-scroll-lock', 'framer-motion', 'recharts', 'nuka-carousel', 'react-day-picker', 'date-fns/locale', 'react-popper', 'date-fns', 'react-beautiful-dnd', '@tinymce/tinymce-react', 'react-images-uploading', 'react-stately', 'react-quill', 'quill', 'quill/dist/quill.snow.css'], factory) :
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Snorre = {}, global._styled, global.React, global.react, global.jsxRuntime, global.jsxRuntime$1, global.reactTransitionGroup, global.ReactPlayer, global.reactAria, null, global.matchSorter, global.bodyScrollLock, global.framerMotion, global.recharts, global.Carousel, global.reactDayPicker, global.locale, global.reactPopper, global.dateFns, global.reactBeautifulDnd, global.tinymceReact, global.ImageUploading, global.reactStately, global.ReactQuill, global.Quill));
|
5
|
-
})(this, (function (exports, _styled, React, react, jsxRuntime, jsxRuntime$1, reactTransitionGroup, ReactPlayer, reactAria, quill_snow_css, matchSorter, bodyScrollLock, framerMotion, recharts, Carousel, reactDayPicker, locale, reactPopper, dateFns, reactBeautifulDnd, tinymceReact, ImageUploading, reactStately, ReactQuill, Quill) { 'use strict';
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@emotion/styled/base'), require('react'), require('@emotion/react'), require('@emotion/react/jsx-runtime'), require('react/jsx-runtime'), require('react-transition-group'), require('react-player'), require('react-aria'), require('react-quill/dist/quill.snow.css'), require('match-sorter'), require('body-scroll-lock'), require('framer-motion'), require('recharts'), require('nuka-carousel'), require('react-day-picker'), require('date-fns/locale'), require('react-popper'), require('date-fns'), require('react-beautiful-dnd'), require('@tinymce/tinymce-react'), require('react-images-uploading'), require('react-stately'), require('react-quill'), require('quill'), require('quill/dist/quill.snow.css'), require('quill/formats/list')) :
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', '@emotion/styled/base', 'react', '@emotion/react', '@emotion/react/jsx-runtime', 'react/jsx-runtime', 'react-transition-group', 'react-player', 'react-aria', 'react-quill/dist/quill.snow.css', 'match-sorter', 'body-scroll-lock', 'framer-motion', 'recharts', 'nuka-carousel', 'react-day-picker', 'date-fns/locale', 'react-popper', 'date-fns', 'react-beautiful-dnd', '@tinymce/tinymce-react', 'react-images-uploading', 'react-stately', 'react-quill', 'quill', 'quill/dist/quill.snow.css', 'quill/formats/list'], factory) :
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Snorre = {}, global._styled, global.React, global.react, global.jsxRuntime, global.jsxRuntime$1, global.reactTransitionGroup, global.ReactPlayer, global.reactAria, null, global.matchSorter, global.bodyScrollLock, global.framerMotion, global.recharts, global.Carousel, global.reactDayPicker, global.locale, global.reactPopper, global.dateFns, global.reactBeautifulDnd, global.tinymceReact, global.ImageUploading, global.reactStately, global.ReactQuill, global.Quill, null, global.ListItem$2));
|
5
|
+
})(this, (function (exports, _styled, React, react, jsxRuntime, jsxRuntime$1, reactTransitionGroup, ReactPlayer, reactAria, quill_snow_css, matchSorter, bodyScrollLock, framerMotion, recharts, Carousel, reactDayPicker, locale, reactPopper, dateFns, reactBeautifulDnd, tinymceReact, ImageUploading, reactStately, ReactQuill, Quill, quill_snow_css$1, ListItem$2) { 'use strict';
|
6
6
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
8
8
|
|
@@ -13,6 +13,7 @@
|
|
13
13
|
var ImageUploading__default = /*#__PURE__*/_interopDefaultLegacy(ImageUploading);
|
14
14
|
var ReactQuill__default = /*#__PURE__*/_interopDefaultLegacy(ReactQuill);
|
15
15
|
var Quill__default = /*#__PURE__*/_interopDefaultLegacy(Quill);
|
16
|
+
var ListItem__default = /*#__PURE__*/_interopDefaultLegacy(ListItem$2);
|
16
17
|
|
17
18
|
const styles$D = {
|
18
19
|
default: (theme, color) => /*#__PURE__*/react.css("display:inline-block;position:relative;min-width:58px;height:10px;div{position:absolute;width:10px;height:10px;border-radius:50%;background:", color ? color : '#ccc', ";animation-timing-function:cubic-bezier(0, 1, 1, 0);}div:nth-of-type(1){left:6px;animation:lds-ellipsis1 0.6s infinite;}div:nth-of-type(2){left:6px;animation:lds-ellipsis2 0.6s infinite;}div:nth-of-type(3){left:24px;animation:lds-ellipsis2 0.6s infinite;}div:nth-of-type(4){left:42px;animation:lds-ellipsis3 0.6s infinite;}@keyframes lds-ellipsis1{0%{transform:scale(0);}100%{transform:scale(1);}}@keyframes lds-ellipsis3{0%{transform:scale(1);}100%{transform:scale(0);}}@keyframes lds-ellipsis2{0%{transform:translate(0, 0);}100%{transform:translate(18px, 0);}}" + (process.env.NODE_ENV === "production" ? "" : ";label:default;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9wYWNrYWdlcy9jb3JlL0FwcExvYWRlci9zdHlsZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBS08iLCJmaWxlIjoiLi4vLi4vLi4vc3JjL3BhY2thZ2VzL2NvcmUvQXBwTG9hZGVyL3N0eWxlcy50cyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0J1xuaW1wb3J0IHsgSUFwcFRoZW1lIH0gZnJvbSAnLi4vLi4vYXBwLXNoZWxsL3RoZW1lJ1xuXG5jb25zdCBzdHlsZXMgPSB7XG4gIGRlZmF1bHQ6ICh0aGVtZTogSUFwcFRoZW1lLCBjb2xvcjogc3RyaW5nIHwgdW5kZWZpbmVkKSA9PlxuICAgIGNzc2BcbiAgICAgIGRpc3BsYXk6IGlubGluZS1ibG9jaztcbiAgICAgIHBvc2l0aW9uOiByZWxhdGl2ZTtcbiAgICAgIG1pbi13aWR0aDogNThweDtcbiAgICAgIGhlaWdodDogMTBweDtcbiAgICAgIGRpdiB7XG4gICAgICAgIHBvc2l0aW9uOiBhYnNvbHV0ZTtcbiAgICAgICAgd2lkdGg6IDEwcHg7XG4gICAgICAgIGhlaWdodDogMTBweDtcbiAgICAgICAgYm9yZGVyLXJhZGl1czogNTAlO1xuICAgICAgICBiYWNrZ3JvdW5kOiAke2NvbG9yID8gY29sb3IgOiAnI2NjYyd9O1xuICAgICAgICBhbmltYXRpb24tdGltaW5nLWZ1bmN0aW9uOiBjdWJpYy1iZXppZXIoMCwgMSwgMSwgMCk7XG4gICAgICB9XG4gICAgICBkaXY6bnRoLW9mLXR5cGUoMSkge1xuICAgICAgICBsZWZ0OiA2cHg7XG4gICAgICAgIGFuaW1hdGlvbjogbGRzLWVsbGlwc2lzMSAwLjZzIGluZmluaXRlO1xuICAgICAgfVxuICAgICAgZGl2Om50aC1vZi10eXBlKDIpIHtcbiAgICAgICAgbGVmdDogNnB4O1xuICAgICAgICBhbmltYXRpb246IGxkcy1lbGxpcHNpczIgMC42cyBpbmZpbml0ZTtcbiAgICAgIH1cbiAgICAgIGRpdjpudGgtb2YtdHlwZSgzKSB7XG4gICAgICAgIGxlZnQ6IDI0cHg7XG4gICAgICAgIGFuaW1hdGlvbjogbGRzLWVsbGlwc2lzMiAwLjZzIGluZmluaXRlO1xuICAgICAgfVxuICAgICAgZGl2Om50aC1vZi10eXBlKDQpIHtcbiAgICAgICAgbGVmdDogNDJweDtcbiAgICAgICAgYW5pbWF0aW9uOiBsZHMtZWxsaXBzaXMzIDAuNnMgaW5maW5pdGU7XG4gICAgICB9XG4gICAgICBAa2V5ZnJhbWVzIGxkcy1lbGxpcHNpczEge1xuICAgICAgICAwJSB7XG4gICAgICAgICAgdHJhbnNmb3JtOiBzY2FsZSgwKTtcbiAgICAgICAgfVxuICAgICAgICAxMDAlIHtcbiAgICAgICAgICB0cmFuc2Zvcm06IHNjYWxlKDEpO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgICBAa2V5ZnJhbWVzIGxkcy1lbGxpcHNpczMge1xuICAgICAgICAwJSB7XG4gICAgICAgICAgdHJhbnNmb3JtOiBzY2FsZSgxKTtcbiAgICAgICAgfVxuICAgICAgICAxMDAlIHtcbiAgICAgICAgICB0cmFuc2Zvcm06IHNjYWxlKDApO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgICBAa2V5ZnJhbWVzIGxkcy1lbGxpcHNpczIge1xuICAgICAgICAwJSB7XG4gICAgICAgICAgdHJhbnNmb3JtOiB0cmFuc2xhdGUoMCwgMCk7XG4gICAgICAgIH1cbiAgICAgICAgMTAwJSB7XG4gICAgICAgICAgdHJhbnNmb3JtOiB0cmFuc2xhdGUoMThweCwgMCk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICBgLFxufVxuXG5leHBvcnQgZGVmYXVsdCBzdHlsZXNcblxuZXhwb3J0IHsgc3R5bGVzIH1cbiJdfQ== */")
|
@@ -35497,6 +35498,46 @@ to {top: 100vh;}
|
|
35497
35498
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
35498
35499
|
});
|
35499
35500
|
|
35501
|
+
class MyListContainer extends ListItem$2.ListContainer {
|
35502
|
+
static tagName = ['OL', 'UL'];
|
35503
|
+
static defaultTag = 'OL';
|
35504
|
+
static create(value) {
|
35505
|
+
return document.createElement(this.getTag(value));
|
35506
|
+
}
|
35507
|
+
static getTag(val) {
|
35508
|
+
const map = {
|
35509
|
+
bullet: 'UL',
|
35510
|
+
ordered: 'OL'
|
35511
|
+
};
|
35512
|
+
return map[val] || this.defaultTag;
|
35513
|
+
}
|
35514
|
+
checkMerge() {
|
35515
|
+
// Only merge if the next list is the same type as this one
|
35516
|
+
return super.checkMerge() && this.domNode.tagName === this.next?.domNode.tagName;
|
35517
|
+
}
|
35518
|
+
}
|
35519
|
+
|
35520
|
+
class MyListItem extends ListItem__default["default"] {
|
35521
|
+
static requiredContainer = MyListContainer;
|
35522
|
+
static register() {
|
35523
|
+
Quill__default["default"].register(MyListContainer, true);
|
35524
|
+
}
|
35525
|
+
optimize(context) {
|
35526
|
+
if (this.statics.requiredContainer && !(this.parent instanceof this.statics.requiredContainer)) {
|
35527
|
+
// Insert the format value (bullet, ordered) into wrap arguments
|
35528
|
+
this.wrap(this.statics.requiredContainer.blotName, MyListItem.formats(this.domNode));
|
35529
|
+
}
|
35530
|
+
super.optimize(context);
|
35531
|
+
}
|
35532
|
+
format(name, value) {
|
35533
|
+
// If the list type is different, wrap this list item in a new MyListContainer of that type
|
35534
|
+
if (name === ListItem__default["default"].blotName && value !== MyListItem.formats(this.domNode)) {
|
35535
|
+
this.wrap(this.statics.requiredContainer.blotName, value);
|
35536
|
+
}
|
35537
|
+
super.format(name, value);
|
35538
|
+
}
|
35539
|
+
}
|
35540
|
+
|
35500
35541
|
const Parchment$1 = Quill__default["default"].import('parchment');
|
35501
35542
|
class IndentAttributor extends Parchment$1.StyleAttributor {
|
35502
35543
|
constructor(...args) {
|
@@ -35526,7 +35567,13 @@ to {top: 100vh;}
|
|
35526
35567
|
scope: Parchment.Scope.BLOCK,
|
35527
35568
|
whitelist: ['1em', '2em', '3em', '4em', '5em', '6em', '7em', '8em', '9em']
|
35528
35569
|
});
|
35570
|
+
const Container = MyListContainer;
|
35571
|
+
Container.allowedChildren = [MyListItem];
|
35529
35572
|
Quill__default["default"].register(IndentStyle, true);
|
35573
|
+
Quill__default["default"].register({
|
35574
|
+
'formats/list': Container,
|
35575
|
+
'formats/ulist': MyListItem
|
35576
|
+
});
|
35530
35577
|
const QuillEditor = ({
|
35531
35578
|
height,
|
35532
35579
|
width,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import Quill from 'quill';
|
2
2
|
const Parchment = Quill.import('parchment');
|
3
|
-
class IndentAttributor extends Parchment.StyleAttributor {
|
3
|
+
export class IndentAttributor extends Parchment.StyleAttributor {
|
4
4
|
constructor(...args) {
|
5
5
|
super(...args);
|
6
6
|
}
|
@@ -12,5 +12,4 @@ class IndentAttributor extends Parchment.StyleAttributor {
|
|
12
12
|
return super.add(node, `${value}em`);
|
13
13
|
}
|
14
14
|
}
|
15
|
-
}
|
16
|
-
export default IndentAttributor;
|
15
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { ListContainer } from 'quill/formats/list';
|
2
|
+
export class MyListContainer extends ListContainer {
|
3
|
+
static tagName = ['OL', 'UL'];
|
4
|
+
static defaultTag = 'OL';
|
5
|
+
static create(value) {
|
6
|
+
return document.createElement(this.getTag(value));
|
7
|
+
}
|
8
|
+
static getTag(val) {
|
9
|
+
const map = {
|
10
|
+
bullet: 'UL',
|
11
|
+
ordered: 'OL'
|
12
|
+
};
|
13
|
+
return map[val] || this.defaultTag;
|
14
|
+
}
|
15
|
+
checkMerge() {
|
16
|
+
// Only merge if the next list is the same type as this one
|
17
|
+
return super.checkMerge() && this.domNode.tagName === this.next?.domNode.tagName;
|
18
|
+
}
|
19
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import Quill from 'quill';
|
2
|
+
import ListItem from 'quill/formats/list';
|
3
|
+
import { MyListContainer } from './ListContainer';
|
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 default MyListItem;
|
@@ -7,7 +7,9 @@ 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
|
10
|
+
import MyListItem from './Attributors/ListItem';
|
11
|
+
import { MyListContainer } from './Attributors/ListContainer';
|
12
|
+
import { IndentAttributor } from './Attributors/IndentAttributor';
|
11
13
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
12
14
|
const Parchment = Quill.import('parchment');
|
13
15
|
//Text direction
|
@@ -22,7 +24,13 @@ let IndentStyle = new IndentAttributor('indent', 'margin-left', {
|
|
22
24
|
scope: Parchment.Scope.BLOCK,
|
23
25
|
whitelist: ['1em', '2em', '3em', '4em', '5em', '6em', '7em', '8em', '9em']
|
24
26
|
});
|
27
|
+
const Container = MyListContainer;
|
28
|
+
Container.allowedChildren = [MyListItem];
|
25
29
|
Quill.register(IndentStyle, true);
|
30
|
+
Quill.register({
|
31
|
+
'formats/list': Container,
|
32
|
+
'formats/ulist': MyListItem
|
33
|
+
});
|
26
34
|
const QuillEditor = ({
|
27
35
|
height,
|
28
36
|
width,
|
@@ -1,7 +1,7 @@
|
|
1
1
|
declare const Parchment: any;
|
2
|
-
declare class IndentAttributor extends Parchment.StyleAttributor {
|
2
|
+
export declare class IndentAttributor extends Parchment.StyleAttributor {
|
3
3
|
constructor(...args: any);
|
4
4
|
add(node: any, value: any): any;
|
5
5
|
}
|
6
|
-
export
|
6
|
+
export {};
|
7
7
|
//# sourceMappingURL=IndentAttributor.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"IndentAttributor.d.ts","sourceRoot":"","sources":["../../../../src/packages/core/QuillEditor/Attributors/IndentAttributor.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,SAAS,EAAgC,GAAG,CAAA;AAClD,
|
1
|
+
{"version":3,"file":"IndentAttributor.d.ts","sourceRoot":"","sources":["../../../../src/packages/core/QuillEditor/Attributors/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"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import Quill from 'quill';
|
2
2
|
const Parchment = Quill.import('parchment');
|
3
|
-
class IndentAttributor extends Parchment.StyleAttributor {
|
3
|
+
export class IndentAttributor extends Parchment.StyleAttributor {
|
4
4
|
constructor(...args) {
|
5
5
|
super(...args);
|
6
6
|
}
|
@@ -12,5 +12,4 @@ class IndentAttributor extends Parchment.StyleAttributor {
|
|
12
12
|
return super.add(node, `${value}em`);
|
13
13
|
}
|
14
14
|
}
|
15
|
-
}
|
16
|
-
export default IndentAttributor;
|
15
|
+
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { ListContainer } from 'quill/formats/list';
|
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(): boolean;
|
8
|
+
}
|
9
|
+
//# sourceMappingURL=ListContainer.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ListContainer.d.ts","sourceRoot":"","sources":["../../../../src/packages/core/QuillEditor/Attributors/ListContainer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAElD,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,19 @@
|
|
1
|
+
import { ListContainer } from 'quill/formats/list';
|
2
|
+
export class MyListContainer extends ListContainer {
|
3
|
+
static tagName = ['OL', 'UL'];
|
4
|
+
static defaultTag = 'OL';
|
5
|
+
static create(value) {
|
6
|
+
return document.createElement(this.getTag(value));
|
7
|
+
}
|
8
|
+
static getTag(val) {
|
9
|
+
const map = {
|
10
|
+
bullet: 'UL',
|
11
|
+
ordered: 'OL'
|
12
|
+
};
|
13
|
+
return map[val] || this.defaultTag;
|
14
|
+
}
|
15
|
+
checkMerge() {
|
16
|
+
// Only merge if the next list is the same type as this one
|
17
|
+
return super.checkMerge() && this.domNode.tagName === this.next?.domNode.tagName;
|
18
|
+
}
|
19
|
+
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import ListItem from 'quill/formats/list';
|
2
|
+
import { MyListContainer } from './ListContainer';
|
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 default MyListItem;
|
10
|
+
//# sourceMappingURL=ListItem.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ListItem.d.ts","sourceRoot":"","sources":["../../../../src/packages/core/QuillEditor/Attributors/ListItem.ts"],"names":[],"mappings":"AACA,OAAO,QAAQ,MAAM,oBAAoB,CAAA;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD,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,eAAe,UAAU,CAAA"}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import Quill from 'quill';
|
2
|
+
import ListItem from 'quill/formats/list';
|
3
|
+
import { MyListContainer } from './ListContainer';
|
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 default MyListItem;
|
@@ -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;
|
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;AAqC3C,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAmK3C,CAAA;AAED,eAAe,WAAW,CAAA"}
|
@@ -7,7 +7,9 @@ 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
|
10
|
+
import MyListItem from './Attributors/ListItem';
|
11
|
+
import { MyListContainer } from './Attributors/ListContainer';
|
12
|
+
import { IndentAttributor } from './Attributors/IndentAttributor';
|
11
13
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
12
14
|
const Parchment = Quill.import('parchment');
|
13
15
|
//Text direction
|
@@ -22,7 +24,13 @@ let IndentStyle = new IndentAttributor('indent', 'margin-left', {
|
|
22
24
|
scope: Parchment.Scope.BLOCK,
|
23
25
|
whitelist: ['1em', '2em', '3em', '4em', '5em', '6em', '7em', '8em', '9em']
|
24
26
|
});
|
27
|
+
const Container = MyListContainer;
|
28
|
+
Container.allowedChildren = [MyListItem];
|
25
29
|
Quill.register(IndentStyle, true);
|
30
|
+
Quill.register({
|
31
|
+
'formats/list': Container,
|
32
|
+
'formats/ulist': MyListItem
|
33
|
+
});
|
26
34
|
const QuillEditor = ({
|
27
35
|
height,
|
28
36
|
width,
|