first commit

This commit is contained in:
Beyhan Oğur
2026-04-26 21:30:42 +03:00
commit 4d92991817
1982 changed files with 284835 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
import { Attributor, ClassAttributor, StyleAttributor } from 'parchment';
declare const AlignAttribute: Attributor;
declare const AlignClass: ClassAttributor;
declare const AlignStyle: StyleAttributor;
export { AlignAttribute, AlignClass, AlignStyle };

View File

@@ -0,0 +1,10 @@
import { Attributor, ClassAttributor, Scope, StyleAttributor } from 'parchment';
const config = {
scope: Scope.BLOCK,
whitelist: ['right', 'center', 'justify']
};
const AlignAttribute = new Attributor('align', 'align', config);
const AlignClass = new ClassAttributor('align', 'ql-align', config);
const AlignStyle = new StyleAttributor('align', 'text-align', config);
export { AlignAttribute, AlignClass, AlignStyle };
//# sourceMappingURL=align.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"align.js","names":["Attributor","ClassAttributor","Scope","StyleAttributor","config","scope","BLOCK","whitelist","AlignAttribute","AlignClass","AlignStyle"],"sources":["../../src/formats/align.ts"],"sourcesContent":["import { Attributor, ClassAttributor, Scope, StyleAttributor } from 'parchment';\n\nconst config = {\n scope: Scope.BLOCK,\n whitelist: ['right', 'center', 'justify'],\n};\n\nconst AlignAttribute = new Attributor('align', 'align', config);\nconst AlignClass = new ClassAttributor('align', 'ql-align', config);\nconst AlignStyle = new StyleAttributor('align', 'text-align', config);\n\nexport { AlignAttribute, AlignClass, AlignStyle };\n"],"mappings":"AAAA,SAASA,UAAU,EAAEC,eAAe,EAAEC,KAAK,EAAEC,eAAe,QAAQ,WAAW;AAE/E,MAAMC,MAAM,GAAG;EACbC,KAAK,EAAEH,KAAK,CAACI,KAAK;EAClBC,SAAS,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS;AAC1C,CAAC;AAED,MAAMC,cAAc,GAAG,IAAIR,UAAU,CAAC,OAAO,EAAE,OAAO,EAAEI,MAAM,CAAC;AAC/D,MAAMK,UAAU,GAAG,IAAIR,eAAe,CAAC,OAAO,EAAE,UAAU,EAAEG,MAAM,CAAC;AACnE,MAAMM,UAAU,GAAG,IAAIP,eAAe,CAAC,OAAO,EAAE,YAAY,EAAEC,MAAM,CAAC;AAErE,SAASI,cAAc,EAAEC,UAAU,EAAEC,UAAU","ignoreList":[]}

View File

@@ -0,0 +1,5 @@
import { ClassAttributor } from 'parchment';
import { ColorAttributor } from './color.js';
declare const BackgroundClass: ClassAttributor;
declare const BackgroundStyle: ColorAttributor;
export { BackgroundClass, BackgroundStyle };

View File

@@ -0,0 +1,10 @@
import { ClassAttributor, Scope } from 'parchment';
import { ColorAttributor } from './color.js';
const BackgroundClass = new ClassAttributor('background', 'ql-bg', {
scope: Scope.INLINE
});
const BackgroundStyle = new ColorAttributor('background', 'background-color', {
scope: Scope.INLINE
});
export { BackgroundClass, BackgroundStyle };
//# sourceMappingURL=background.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"background.js","names":["ClassAttributor","Scope","ColorAttributor","BackgroundClass","scope","INLINE","BackgroundStyle"],"sources":["../../src/formats/background.ts"],"sourcesContent":["import { ClassAttributor, Scope } from 'parchment';\nimport { ColorAttributor } from './color.js';\n\nconst BackgroundClass = new ClassAttributor('background', 'ql-bg', {\n scope: Scope.INLINE,\n});\nconst BackgroundStyle = new ColorAttributor('background', 'background-color', {\n scope: Scope.INLINE,\n});\n\nexport { BackgroundClass, BackgroundStyle };\n"],"mappings":"AAAA,SAASA,eAAe,EAAEC,KAAK,QAAQ,WAAW;AAClD,SAASC,eAAe,QAAQ,YAAY;AAE5C,MAAMC,eAAe,GAAG,IAAIH,eAAe,CAAC,YAAY,EAAE,OAAO,EAAE;EACjEI,KAAK,EAAEH,KAAK,CAACI;AACf,CAAC,CAAC;AACF,MAAMC,eAAe,GAAG,IAAIJ,eAAe,CAAC,YAAY,EAAE,kBAAkB,EAAE;EAC5EE,KAAK,EAAEH,KAAK,CAACI;AACf,CAAC,CAAC;AAEF,SAASF,eAAe,EAAEG,eAAe","ignoreList":[]}

View File

@@ -0,0 +1,6 @@
import Block from '../blots/block.js';
declare class Blockquote extends Block {
static blotName: string;
static tagName: string;
}
export default Blockquote;

View File

@@ -0,0 +1,7 @@
import Block from '../blots/block.js';
class Blockquote extends Block {
static blotName = 'blockquote';
static tagName = 'blockquote';
}
export default Blockquote;
//# sourceMappingURL=blockquote.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"blockquote.js","names":["Block","Blockquote","blotName","tagName"],"sources":["../../src/formats/blockquote.ts"],"sourcesContent":["import Block from '../blots/block.js';\n\nclass Blockquote extends Block {\n static blotName = 'blockquote';\n static tagName = 'blockquote';\n}\n\nexport default Blockquote;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,mBAAmB;AAErC,MAAMC,UAAU,SAASD,KAAK,CAAC;EAC7B,OAAOE,QAAQ,GAAG,YAAY;EAC9B,OAAOC,OAAO,GAAG,YAAY;AAC/B;AAEA,eAAeF,UAAU","ignoreList":[]}

11
public/assets/quill/formats/bold.d.ts vendored Normal file
View File

@@ -0,0 +1,11 @@
import Inline from '../blots/inline.js';
declare class Bold extends Inline {
static blotName: string;
static tagName: string[];
static create(): HTMLElement;
static formats(): boolean;
optimize(context: {
[key: string]: any;
}): void;
}
export default Bold;

View File

@@ -0,0 +1,19 @@
import Inline from '../blots/inline.js';
class Bold extends Inline {
static blotName = 'bold';
static tagName = ['STRONG', 'B'];
static create() {
return super.create();
}
static formats() {
return true;
}
optimize(context) {
super.optimize(context);
if (this.domNode.tagName !== this.statics.tagName[0]) {
this.replaceWith(this.statics.blotName);
}
}
}
export default Bold;
//# sourceMappingURL=bold.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"bold.js","names":["Inline","Bold","blotName","tagName","create","formats","optimize","context","domNode","statics","replaceWith"],"sources":["../../src/formats/bold.ts"],"sourcesContent":["import Inline from '../blots/inline.js';\n\nclass Bold extends Inline {\n static blotName = 'bold';\n static tagName = ['STRONG', 'B'];\n\n static create() {\n return super.create();\n }\n\n static formats() {\n return true;\n }\n\n optimize(context: { [key: string]: any }) {\n super.optimize(context);\n if (this.domNode.tagName !== this.statics.tagName[0]) {\n this.replaceWith(this.statics.blotName);\n }\n }\n}\n\nexport default Bold;\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,oBAAoB;AAEvC,MAAMC,IAAI,SAASD,MAAM,CAAC;EACxB,OAAOE,QAAQ,GAAG,MAAM;EACxB,OAAOC,OAAO,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC;EAEhC,OAAOC,MAAMA,CAAA,EAAG;IACd,OAAO,KAAK,CAACA,MAAM,CAAC,CAAC;EACvB;EAEA,OAAOC,OAAOA,CAAA,EAAG;IACf,OAAO,IAAI;EACb;EAEAC,QAAQA,CAACC,OAA+B,EAAE;IACxC,KAAK,CAACD,QAAQ,CAACC,OAAO,CAAC;IACvB,IAAI,IAAI,CAACC,OAAO,CAACL,OAAO,KAAK,IAAI,CAACM,OAAO,CAACN,OAAO,CAAC,CAAC,CAAC,EAAE;MACpD,IAAI,CAACO,WAAW,CAAC,IAAI,CAACD,OAAO,CAACP,QAAQ,CAAC;IACzC;EACF;AACF;AAEA,eAAeD,IAAI","ignoreList":[]}

15
public/assets/quill/formats/code.d.ts vendored Normal file
View File

@@ -0,0 +1,15 @@
import Block from '../blots/block.js';
import Inline from '../blots/inline.js';
import Container from '../blots/container.js';
declare class CodeBlockContainer extends Container {
static create(value: string): Element;
code(index: number, length: number): string;
html(index: number, length: number): string;
}
declare class CodeBlock extends Block {
static TAB: string;
static register(): void;
}
declare class Code extends Inline {
}
export { Code, CodeBlockContainer, CodeBlock as default };

View File

@@ -0,0 +1,44 @@
import Block from '../blots/block.js';
import Break from '../blots/break.js';
import Cursor from '../blots/cursor.js';
import Inline from '../blots/inline.js';
import TextBlot, { escapeText } from '../blots/text.js';
import Container from '../blots/container.js';
import Quill from '../core/quill.js';
class CodeBlockContainer extends Container {
static create(value) {
const domNode = super.create(value);
domNode.setAttribute('spellcheck', 'false');
return domNode;
}
code(index, length) {
return this.children
// @ts-expect-error
.map(child => child.length() <= 1 ? '' : child.domNode.innerText).join('\n').slice(index, index + length);
}
html(index, length) {
// `\n`s are needed in order to support empty lines at the beginning and the end.
// https://html.spec.whatwg.org/multipage/syntax.html#element-restrictions
return `<pre>\n${escapeText(this.code(index, length))}\n</pre>`;
}
}
class CodeBlock extends Block {
static TAB = ' ';
static register() {
Quill.register(CodeBlockContainer);
}
}
class Code extends Inline {}
Code.blotName = 'code';
Code.tagName = 'CODE';
CodeBlock.blotName = 'code-block';
CodeBlock.className = 'ql-code-block';
CodeBlock.tagName = 'DIV';
CodeBlockContainer.blotName = 'code-block-container';
CodeBlockContainer.className = 'ql-code-block-container';
CodeBlockContainer.tagName = 'DIV';
CodeBlockContainer.allowedChildren = [CodeBlock];
CodeBlock.allowedChildren = [TextBlot, Break, Cursor];
CodeBlock.requiredContainer = CodeBlockContainer;
export { Code, CodeBlockContainer, CodeBlock as default };
//# sourceMappingURL=code.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"code.js","names":["Block","Break","Cursor","Inline","TextBlot","escapeText","Container","Quill","CodeBlockContainer","create","value","domNode","setAttribute","code","index","length","children","map","child","innerText","join","slice","html","CodeBlock","TAB","register","Code","blotName","tagName","className","allowedChildren","requiredContainer","default"],"sources":["../../src/formats/code.ts"],"sourcesContent":["import Block from '../blots/block.js';\nimport Break from '../blots/break.js';\nimport Cursor from '../blots/cursor.js';\nimport Inline from '../blots/inline.js';\nimport TextBlot, { escapeText } from '../blots/text.js';\nimport Container from '../blots/container.js';\nimport Quill from '../core/quill.js';\n\nclass CodeBlockContainer extends Container {\n static create(value: string) {\n const domNode = super.create(value) as Element;\n domNode.setAttribute('spellcheck', 'false');\n return domNode;\n }\n\n code(index: number, length: number) {\n return (\n this.children\n // @ts-expect-error\n .map((child) => (child.length() <= 1 ? '' : child.domNode.innerText))\n .join('\\n')\n .slice(index, index + length)\n );\n }\n\n html(index: number, length: number) {\n // `\\n`s are needed in order to support empty lines at the beginning and the end.\n // https://html.spec.whatwg.org/multipage/syntax.html#element-restrictions\n return `<pre>\\n${escapeText(this.code(index, length))}\\n</pre>`;\n }\n}\n\nclass CodeBlock extends Block {\n static TAB = ' ';\n\n static register() {\n Quill.register(CodeBlockContainer);\n }\n}\n\nclass Code extends Inline {}\nCode.blotName = 'code';\nCode.tagName = 'CODE';\n\nCodeBlock.blotName = 'code-block';\nCodeBlock.className = 'ql-code-block';\nCodeBlock.tagName = 'DIV';\nCodeBlockContainer.blotName = 'code-block-container';\nCodeBlockContainer.className = 'ql-code-block-container';\nCodeBlockContainer.tagName = 'DIV';\n\nCodeBlockContainer.allowedChildren = [CodeBlock];\n\nCodeBlock.allowedChildren = [TextBlot, Break, Cursor];\nCodeBlock.requiredContainer = CodeBlockContainer;\n\nexport { Code, CodeBlockContainer, CodeBlock as default };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,mBAAmB;AACrC,OAAOC,KAAK,MAAM,mBAAmB;AACrC,OAAOC,MAAM,MAAM,oBAAoB;AACvC,OAAOC,MAAM,MAAM,oBAAoB;AACvC,OAAOC,QAAQ,IAAIC,UAAU,QAAQ,kBAAkB;AACvD,OAAOC,SAAS,MAAM,uBAAuB;AAC7C,OAAOC,KAAK,MAAM,kBAAkB;AAEpC,MAAMC,kBAAkB,SAASF,SAAS,CAAC;EACzC,OAAOG,MAAMA,CAACC,KAAa,EAAE;IAC3B,MAAMC,OAAO,GAAG,KAAK,CAACF,MAAM,CAACC,KAAK,CAAY;IAC9CC,OAAO,CAACC,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC;IAC3C,OAAOD,OAAO;EAChB;EAEAE,IAAIA,CAACC,KAAa,EAAEC,MAAc,EAAE;IAClC,OACE,IAAI,CAACC;IACH;IAAA,CACCC,GAAG,CAAEC,KAAK,IAAMA,KAAK,CAACH,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAGG,KAAK,CAACP,OAAO,CAACQ,SAAU,CAAC,CACpEC,IAAI,CAAC,IAAI,CAAC,CACVC,KAAK,CAACP,KAAK,EAAEA,KAAK,GAAGC,MAAM,CAAC;EAEnC;EAEAO,IAAIA,CAACR,KAAa,EAAEC,MAAc,EAAE;IAClC;IACA;IACA,OAAQ,UAASV,UAAU,CAAC,IAAI,CAACQ,IAAI,CAACC,KAAK,EAAEC,MAAM,CAAC,CAAE,UAAS;EACjE;AACF;AAEA,MAAMQ,SAAS,SAASvB,KAAK,CAAC;EAC5B,OAAOwB,GAAG,GAAG,IAAI;EAEjB,OAAOC,QAAQA,CAAA,EAAG;IAChBlB,KAAK,CAACkB,QAAQ,CAACjB,kBAAkB,CAAC;EACpC;AACF;AAEA,MAAMkB,IAAI,SAASvB,MAAM,CAAC;AAC1BuB,IAAI,CAACC,QAAQ,GAAG,MAAM;AACtBD,IAAI,CAACE,OAAO,GAAG,MAAM;AAErBL,SAAS,CAACI,QAAQ,GAAG,YAAY;AACjCJ,SAAS,CAACM,SAAS,GAAG,eAAe;AACrCN,SAAS,CAACK,OAAO,GAAG,KAAK;AACzBpB,kBAAkB,CAACmB,QAAQ,GAAG,sBAAsB;AACpDnB,kBAAkB,CAACqB,SAAS,GAAG,yBAAyB;AACxDrB,kBAAkB,CAACoB,OAAO,GAAG,KAAK;AAElCpB,kBAAkB,CAACsB,eAAe,GAAG,CAACP,SAAS,CAAC;AAEhDA,SAAS,CAACO,eAAe,GAAG,CAAC1B,QAAQ,EAAEH,KAAK,EAAEC,MAAM,CAAC;AACrDqB,SAAS,CAACQ,iBAAiB,GAAGvB,kBAAkB;AAEhD,SAASkB,IAAI,EAAElB,kBAAkB,EAAEe,SAAS,IAAIS,OAAO","ignoreList":[]}

View File

@@ -0,0 +1,7 @@
import { ClassAttributor, StyleAttributor } from 'parchment';
declare class ColorAttributor extends StyleAttributor {
value(domNode: HTMLElement): string;
}
declare const ColorClass: ClassAttributor;
declare const ColorStyle: ColorAttributor;
export { ColorAttributor, ColorClass, ColorStyle };

View File

@@ -0,0 +1,18 @@
import { ClassAttributor, Scope, StyleAttributor } from 'parchment';
class ColorAttributor extends StyleAttributor {
value(domNode) {
let value = super.value(domNode);
if (!value.startsWith('rgb(')) return value;
value = value.replace(/^[^\d]+/, '').replace(/[^\d]+$/, '');
const hex = value.split(',').map(component => `00${parseInt(component, 10).toString(16)}`.slice(-2)).join('');
return `#${hex}`;
}
}
const ColorClass = new ClassAttributor('color', 'ql-color', {
scope: Scope.INLINE
});
const ColorStyle = new ColorAttributor('color', 'color', {
scope: Scope.INLINE
});
export { ColorAttributor, ColorClass, ColorStyle };
//# sourceMappingURL=color.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"color.js","names":["ClassAttributor","Scope","StyleAttributor","ColorAttributor","value","domNode","startsWith","replace","hex","split","map","component","parseInt","toString","slice","join","ColorClass","scope","INLINE","ColorStyle"],"sources":["../../src/formats/color.ts"],"sourcesContent":["import { ClassAttributor, Scope, StyleAttributor } from 'parchment';\n\nclass ColorAttributor extends StyleAttributor {\n value(domNode: HTMLElement) {\n let value = super.value(domNode) as string;\n if (!value.startsWith('rgb(')) return value;\n value = value.replace(/^[^\\d]+/, '').replace(/[^\\d]+$/, '');\n const hex = value\n .split(',')\n .map((component) => `00${parseInt(component, 10).toString(16)}`.slice(-2))\n .join('');\n return `#${hex}`;\n }\n}\n\nconst ColorClass = new ClassAttributor('color', 'ql-color', {\n scope: Scope.INLINE,\n});\nconst ColorStyle = new ColorAttributor('color', 'color', {\n scope: Scope.INLINE,\n});\n\nexport { ColorAttributor, ColorClass, ColorStyle };\n"],"mappings":"AAAA,SAASA,eAAe,EAAEC,KAAK,EAAEC,eAAe,QAAQ,WAAW;AAEnE,MAAMC,eAAe,SAASD,eAAe,CAAC;EAC5CE,KAAKA,CAACC,OAAoB,EAAE;IAC1B,IAAID,KAAK,GAAG,KAAK,CAACA,KAAK,CAACC,OAAO,CAAW;IAC1C,IAAI,CAACD,KAAK,CAACE,UAAU,CAAC,MAAM,CAAC,EAAE,OAAOF,KAAK;IAC3CA,KAAK,GAAGA,KAAK,CAACG,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAACA,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC;IAC3D,MAAMC,GAAG,GAAGJ,KAAK,CACdK,KAAK,CAAC,GAAG,CAAC,CACVC,GAAG,CAAEC,SAAS,IAAM,KAAIC,QAAQ,CAACD,SAAS,EAAE,EAAE,CAAC,CAACE,QAAQ,CAAC,EAAE,CAAE,EAAC,CAACC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CACzEC,IAAI,CAAC,EAAE,CAAC;IACX,OAAQ,IAAGP,GAAI,EAAC;EAClB;AACF;AAEA,MAAMQ,UAAU,GAAG,IAAIhB,eAAe,CAAC,OAAO,EAAE,UAAU,EAAE;EAC1DiB,KAAK,EAAEhB,KAAK,CAACiB;AACf,CAAC,CAAC;AACF,MAAMC,UAAU,GAAG,IAAIhB,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE;EACvDc,KAAK,EAAEhB,KAAK,CAACiB;AACf,CAAC,CAAC;AAEF,SAASf,eAAe,EAAEa,UAAU,EAAEG,UAAU","ignoreList":[]}

View File

@@ -0,0 +1,5 @@
import { Attributor, ClassAttributor, StyleAttributor } from 'parchment';
declare const DirectionAttribute: Attributor;
declare const DirectionClass: ClassAttributor;
declare const DirectionStyle: StyleAttributor;
export { DirectionAttribute, DirectionClass, DirectionStyle };

View File

@@ -0,0 +1,10 @@
import { Attributor, ClassAttributor, Scope, StyleAttributor } from 'parchment';
const config = {
scope: Scope.BLOCK,
whitelist: ['rtl']
};
const DirectionAttribute = new Attributor('direction', 'dir', config);
const DirectionClass = new ClassAttributor('direction', 'ql-direction', config);
const DirectionStyle = new StyleAttributor('direction', 'direction', config);
export { DirectionAttribute, DirectionClass, DirectionStyle };
//# sourceMappingURL=direction.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"direction.js","names":["Attributor","ClassAttributor","Scope","StyleAttributor","config","scope","BLOCK","whitelist","DirectionAttribute","DirectionClass","DirectionStyle"],"sources":["../../src/formats/direction.ts"],"sourcesContent":["import { Attributor, ClassAttributor, Scope, StyleAttributor } from 'parchment';\n\nconst config = {\n scope: Scope.BLOCK,\n whitelist: ['rtl'],\n};\n\nconst DirectionAttribute = new Attributor('direction', 'dir', config);\nconst DirectionClass = new ClassAttributor('direction', 'ql-direction', config);\nconst DirectionStyle = new StyleAttributor('direction', 'direction', config);\n\nexport { DirectionAttribute, DirectionClass, DirectionStyle };\n"],"mappings":"AAAA,SAASA,UAAU,EAAEC,eAAe,EAAEC,KAAK,EAAEC,eAAe,QAAQ,WAAW;AAE/E,MAAMC,MAAM,GAAG;EACbC,KAAK,EAAEH,KAAK,CAACI,KAAK;EAClBC,SAAS,EAAE,CAAC,KAAK;AACnB,CAAC;AAED,MAAMC,kBAAkB,GAAG,IAAIR,UAAU,CAAC,WAAW,EAAE,KAAK,EAAEI,MAAM,CAAC;AACrE,MAAMK,cAAc,GAAG,IAAIR,eAAe,CAAC,WAAW,EAAE,cAAc,EAAEG,MAAM,CAAC;AAC/E,MAAMM,cAAc,GAAG,IAAIP,eAAe,CAAC,WAAW,EAAE,WAAW,EAAEC,MAAM,CAAC;AAE5E,SAASI,kBAAkB,EAAEC,cAAc,EAAEC,cAAc","ignoreList":[]}

7
public/assets/quill/formats/font.d.ts vendored Normal file
View File

@@ -0,0 +1,7 @@
import { ClassAttributor, StyleAttributor } from 'parchment';
declare const FontClass: ClassAttributor;
declare class FontStyleAttributor extends StyleAttributor {
value(node: HTMLElement): any;
}
declare const FontStyle: FontStyleAttributor;
export { FontStyle, FontClass };

View File

@@ -0,0 +1,14 @@
import { ClassAttributor, Scope, StyleAttributor } from 'parchment';
const config = {
scope: Scope.INLINE,
whitelist: ['serif', 'monospace']
};
const FontClass = new ClassAttributor('font', 'ql-font', config);
class FontStyleAttributor extends StyleAttributor {
value(node) {
return super.value(node).replace(/["']/g, '');
}
}
const FontStyle = new FontStyleAttributor('font', 'font-family', config);
export { FontStyle, FontClass };
//# sourceMappingURL=font.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"font.js","names":["ClassAttributor","Scope","StyleAttributor","config","scope","INLINE","whitelist","FontClass","FontStyleAttributor","value","node","replace","FontStyle"],"sources":["../../src/formats/font.ts"],"sourcesContent":["import { ClassAttributor, Scope, StyleAttributor } from 'parchment';\n\nconst config = {\n scope: Scope.INLINE,\n whitelist: ['serif', 'monospace'],\n};\n\nconst FontClass = new ClassAttributor('font', 'ql-font', config);\n\nclass FontStyleAttributor extends StyleAttributor {\n value(node: HTMLElement) {\n return super.value(node).replace(/[\"']/g, '');\n }\n}\n\nconst FontStyle = new FontStyleAttributor('font', 'font-family', config);\n\nexport { FontStyle, FontClass };\n"],"mappings":"AAAA,SAASA,eAAe,EAAEC,KAAK,EAAEC,eAAe,QAAQ,WAAW;AAEnE,MAAMC,MAAM,GAAG;EACbC,KAAK,EAAEH,KAAK,CAACI,MAAM;EACnBC,SAAS,EAAE,CAAC,OAAO,EAAE,WAAW;AAClC,CAAC;AAED,MAAMC,SAAS,GAAG,IAAIP,eAAe,CAAC,MAAM,EAAE,SAAS,EAAEG,MAAM,CAAC;AAEhE,MAAMK,mBAAmB,SAASN,eAAe,CAAC;EAChDO,KAAKA,CAACC,IAAiB,EAAE;IACvB,OAAO,KAAK,CAACD,KAAK,CAACC,IAAI,CAAC,CAACC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;EAC/C;AACF;AAEA,MAAMC,SAAS,GAAG,IAAIJ,mBAAmB,CAAC,MAAM,EAAE,aAAa,EAAEL,MAAM,CAAC;AAExE,SAASS,SAAS,EAAEL,SAAS","ignoreList":[]}

View File

@@ -0,0 +1,10 @@
import Embed from '../blots/embed.js';
declare class Formula extends Embed {
static blotName: string;
static className: string;
static tagName: string;
static create(value: string): Element;
static value(domNode: Element): string | null;
html(): string;
}
export default Formula;

View File

@@ -0,0 +1,33 @@
import Embed from '../blots/embed.js';
class Formula extends Embed {
static blotName = 'formula';
static className = 'ql-formula';
static tagName = 'SPAN';
static create(value) {
// @ts-expect-error
if (window.katex == null) {
throw new Error('Formula module requires KaTeX.');
}
const node = super.create(value);
if (typeof value === 'string') {
// @ts-expect-error
window.katex.render(value, node, {
throwOnError: false,
errorColor: '#f00'
});
node.setAttribute('data-value', value);
}
return node;
}
static value(domNode) {
return domNode.getAttribute('data-value');
}
html() {
const {
formula
} = this.value();
return `<span>${formula}</span>`;
}
}
export default Formula;
//# sourceMappingURL=formula.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"formula.js","names":["Embed","Formula","blotName","className","tagName","create","value","window","katex","Error","node","render","throwOnError","errorColor","setAttribute","domNode","getAttribute","html","formula"],"sources":["../../src/formats/formula.ts"],"sourcesContent":["import Embed from '../blots/embed.js';\n\nclass Formula extends Embed {\n static blotName = 'formula';\n static className = 'ql-formula';\n static tagName = 'SPAN';\n\n static create(value: string) {\n // @ts-expect-error\n if (window.katex == null) {\n throw new Error('Formula module requires KaTeX.');\n }\n const node = super.create(value) as Element;\n if (typeof value === 'string') {\n // @ts-expect-error\n window.katex.render(value, node, {\n throwOnError: false,\n errorColor: '#f00',\n });\n node.setAttribute('data-value', value);\n }\n return node;\n }\n\n static value(domNode: Element) {\n return domNode.getAttribute('data-value');\n }\n\n html() {\n const { formula } = this.value();\n return `<span>${formula}</span>`;\n }\n}\n\nexport default Formula;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,mBAAmB;AAErC,MAAMC,OAAO,SAASD,KAAK,CAAC;EAC1B,OAAOE,QAAQ,GAAG,SAAS;EAC3B,OAAOC,SAAS,GAAG,YAAY;EAC/B,OAAOC,OAAO,GAAG,MAAM;EAEvB,OAAOC,MAAMA,CAACC,KAAa,EAAE;IAC3B;IACA,IAAIC,MAAM,CAACC,KAAK,IAAI,IAAI,EAAE;MACxB,MAAM,IAAIC,KAAK,CAAC,gCAAgC,CAAC;IACnD;IACA,MAAMC,IAAI,GAAG,KAAK,CAACL,MAAM,CAACC,KAAK,CAAY;IAC3C,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;MAC7B;MACAC,MAAM,CAACC,KAAK,CAACG,MAAM,CAACL,KAAK,EAAEI,IAAI,EAAE;QAC/BE,YAAY,EAAE,KAAK;QACnBC,UAAU,EAAE;MACd,CAAC,CAAC;MACFH,IAAI,CAACI,YAAY,CAAC,YAAY,EAAER,KAAK,CAAC;IACxC;IACA,OAAOI,IAAI;EACb;EAEA,OAAOJ,KAAKA,CAACS,OAAgB,EAAE;IAC7B,OAAOA,OAAO,CAACC,YAAY,CAAC,YAAY,CAAC;EAC3C;EAEAC,IAAIA,CAAA,EAAG;IACL,MAAM;MAAEC;IAAQ,CAAC,GAAG,IAAI,CAACZ,KAAK,CAAC,CAAC;IAChC,OAAQ,SAAQY,OAAQ,SAAQ;EAClC;AACF;AAEA,eAAejB,OAAO","ignoreList":[]}

View File

@@ -0,0 +1,7 @@
import Block from '../blots/block.js';
declare class Header extends Block {
static blotName: string;
static tagName: string[];
static formats(domNode: Element): number;
}
export default Header;

View File

@@ -0,0 +1,10 @@
import Block from '../blots/block.js';
class Header extends Block {
static blotName = 'header';
static tagName = ['H1', 'H2', 'H3', 'H4', 'H5', 'H6'];
static formats(domNode) {
return this.tagName.indexOf(domNode.tagName) + 1;
}
}
export default Header;
//# sourceMappingURL=header.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"header.js","names":["Block","Header","blotName","tagName","formats","domNode","indexOf"],"sources":["../../src/formats/header.ts"],"sourcesContent":["import Block from '../blots/block.js';\n\nclass Header extends Block {\n static blotName = 'header';\n static tagName = ['H1', 'H2', 'H3', 'H4', 'H5', 'H6'];\n\n static formats(domNode: Element) {\n return this.tagName.indexOf(domNode.tagName) + 1;\n }\n}\n\nexport default Header;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,mBAAmB;AAErC,MAAMC,MAAM,SAASD,KAAK,CAAC;EACzB,OAAOE,QAAQ,GAAG,QAAQ;EAC1B,OAAOC,OAAO,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;EAErD,OAAOC,OAAOA,CAACC,OAAgB,EAAE;IAC/B,OAAO,IAAI,CAACF,OAAO,CAACG,OAAO,CAACD,OAAO,CAACF,OAAO,CAAC,GAAG,CAAC;EAClD;AACF;AAEA,eAAeF,MAAM","ignoreList":[]}

13
public/assets/quill/formats/image.d.ts vendored Normal file
View File

@@ -0,0 +1,13 @@
import { EmbedBlot } from 'parchment';
declare class Image extends EmbedBlot {
static blotName: string;
static tagName: string;
static create(value: string): Element;
static formats(domNode: Element): Record<string, string | null>;
static match(url: string): boolean;
static sanitize(url: string): string;
static value(domNode: Element): string | null;
domNode: HTMLImageElement;
format(name: string, value: string): void;
}
export default Image;

View File

@@ -0,0 +1,44 @@
import { EmbedBlot } from 'parchment';
import { sanitize } from './link.js';
const ATTRIBUTES = ['alt', 'height', 'width'];
class Image extends EmbedBlot {
static blotName = 'image';
static tagName = 'IMG';
static create(value) {
const node = super.create(value);
if (typeof value === 'string') {
node.setAttribute('src', this.sanitize(value));
}
return node;
}
static formats(domNode) {
return ATTRIBUTES.reduce((formats, attribute) => {
if (domNode.hasAttribute(attribute)) {
formats[attribute] = domNode.getAttribute(attribute);
}
return formats;
}, {});
}
static match(url) {
return /\.(jpe?g|gif|png)$/.test(url) || /^data:image\/.+;base64/.test(url);
}
static sanitize(url) {
return sanitize(url, ['http', 'https', 'data']) ? url : '//:0';
}
static value(domNode) {
return domNode.getAttribute('src');
}
format(name, value) {
if (ATTRIBUTES.indexOf(name) > -1) {
if (value) {
this.domNode.setAttribute(name, value);
} else {
this.domNode.removeAttribute(name);
}
} else {
super.format(name, value);
}
}
}
export default Image;
//# sourceMappingURL=image.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"image.js","names":["EmbedBlot","sanitize","ATTRIBUTES","Image","blotName","tagName","create","value","node","setAttribute","formats","domNode","reduce","attribute","hasAttribute","getAttribute","match","url","test","format","name","indexOf","removeAttribute"],"sources":["../../src/formats/image.ts"],"sourcesContent":["import { EmbedBlot } from 'parchment';\nimport { sanitize } from './link.js';\n\nconst ATTRIBUTES = ['alt', 'height', 'width'];\n\nclass Image extends EmbedBlot {\n static blotName = 'image';\n static tagName = 'IMG';\n\n static create(value: string) {\n const node = super.create(value) as Element;\n if (typeof value === 'string') {\n node.setAttribute('src', this.sanitize(value));\n }\n return node;\n }\n\n static formats(domNode: Element) {\n return ATTRIBUTES.reduce(\n (formats: Record<string, string | null>, attribute) => {\n if (domNode.hasAttribute(attribute)) {\n formats[attribute] = domNode.getAttribute(attribute);\n }\n return formats;\n },\n {},\n );\n }\n\n static match(url: string) {\n return /\\.(jpe?g|gif|png)$/.test(url) || /^data:image\\/.+;base64/.test(url);\n }\n\n static sanitize(url: string) {\n return sanitize(url, ['http', 'https', 'data']) ? url : '//:0';\n }\n\n static value(domNode: Element) {\n return domNode.getAttribute('src');\n }\n\n domNode: HTMLImageElement;\n\n format(name: string, value: string) {\n if (ATTRIBUTES.indexOf(name) > -1) {\n if (value) {\n this.domNode.setAttribute(name, value);\n } else {\n this.domNode.removeAttribute(name);\n }\n } else {\n super.format(name, value);\n }\n }\n}\n\nexport default Image;\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,WAAW;AACrC,SAASC,QAAQ,QAAQ,WAAW;AAEpC,MAAMC,UAAU,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC;AAE7C,MAAMC,KAAK,SAASH,SAAS,CAAC;EAC5B,OAAOI,QAAQ,GAAG,OAAO;EACzB,OAAOC,OAAO,GAAG,KAAK;EAEtB,OAAOC,MAAMA,CAACC,KAAa,EAAE;IAC3B,MAAMC,IAAI,GAAG,KAAK,CAACF,MAAM,CAACC,KAAK,CAAY;IAC3C,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;MAC7BC,IAAI,CAACC,YAAY,CAAC,KAAK,EAAE,IAAI,CAACR,QAAQ,CAACM,KAAK,CAAC,CAAC;IAChD;IACA,OAAOC,IAAI;EACb;EAEA,OAAOE,OAAOA,CAACC,OAAgB,EAAE;IAC/B,OAAOT,UAAU,CAACU,MAAM,CACtB,CAACF,OAAsC,EAAEG,SAAS,KAAK;MACrD,IAAIF,OAAO,CAACG,YAAY,CAACD,SAAS,CAAC,EAAE;QACnCH,OAAO,CAACG,SAAS,CAAC,GAAGF,OAAO,CAACI,YAAY,CAACF,SAAS,CAAC;MACtD;MACA,OAAOH,OAAO;IAChB,CAAC,EACD,CAAC,CACH,CAAC;EACH;EAEA,OAAOM,KAAKA,CAACC,GAAW,EAAE;IACxB,OAAO,oBAAoB,CAACC,IAAI,CAACD,GAAG,CAAC,IAAI,wBAAwB,CAACC,IAAI,CAACD,GAAG,CAAC;EAC7E;EAEA,OAAOhB,QAAQA,CAACgB,GAAW,EAAE;IAC3B,OAAOhB,QAAQ,CAACgB,GAAG,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,GAAGA,GAAG,GAAG,MAAM;EAChE;EAEA,OAAOV,KAAKA,CAACI,OAAgB,EAAE;IAC7B,OAAOA,OAAO,CAACI,YAAY,CAAC,KAAK,CAAC;EACpC;EAIAI,MAAMA,CAACC,IAAY,EAAEb,KAAa,EAAE;IAClC,IAAIL,UAAU,CAACmB,OAAO,CAACD,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE;MACjC,IAAIb,KAAK,EAAE;QACT,IAAI,CAACI,OAAO,CAACF,YAAY,CAACW,IAAI,EAAEb,KAAK,CAAC;MACxC,CAAC,MAAM;QACL,IAAI,CAACI,OAAO,CAACW,eAAe,CAACF,IAAI,CAAC;MACpC;IACF,CAAC,MAAM;MACL,KAAK,CAACD,MAAM,CAACC,IAAI,EAAEb,KAAK,CAAC;IAC3B;EACF;AACF;AAEA,eAAeJ,KAAK","ignoreList":[]}

View File

@@ -0,0 +1,8 @@
import { ClassAttributor } from 'parchment';
declare class IndentAttributor extends ClassAttributor {
add(node: HTMLElement, value: string | number): boolean;
canAdd(node: HTMLElement, value: string): boolean;
value(node: HTMLElement): number | undefined;
}
declare const IndentClass: IndentAttributor;
export default IndentClass;

View File

@@ -0,0 +1,30 @@
import { ClassAttributor, Scope } from 'parchment';
class IndentAttributor extends ClassAttributor {
add(node, value) {
let normalizedValue = 0;
if (value === '+1' || value === '-1') {
const indent = this.value(node) || 0;
normalizedValue = value === '+1' ? indent + 1 : indent - 1;
} else if (typeof value === 'number') {
normalizedValue = value;
}
if (normalizedValue === 0) {
this.remove(node);
return true;
}
return super.add(node, normalizedValue.toString());
}
canAdd(node, value) {
return super.canAdd(node, value) || super.canAdd(node, parseInt(value, 10));
}
value(node) {
return parseInt(super.value(node), 10) || undefined; // Don't return NaN
}
}
const IndentClass = new IndentAttributor('indent', 'ql-indent', {
scope: Scope.BLOCK,
// @ts-expect-error
whitelist: [1, 2, 3, 4, 5, 6, 7, 8]
});
export default IndentClass;
//# sourceMappingURL=indent.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"indent.js","names":["ClassAttributor","Scope","IndentAttributor","add","node","value","normalizedValue","indent","remove","toString","canAdd","parseInt","undefined","IndentClass","scope","BLOCK","whitelist"],"sources":["../../src/formats/indent.ts"],"sourcesContent":["import { ClassAttributor, Scope } from 'parchment';\n\nclass IndentAttributor extends ClassAttributor {\n add(node: HTMLElement, value: string | number) {\n let normalizedValue = 0;\n if (value === '+1' || value === '-1') {\n const indent = this.value(node) || 0;\n normalizedValue = value === '+1' ? indent + 1 : indent - 1;\n } else if (typeof value === 'number') {\n normalizedValue = value;\n }\n if (normalizedValue === 0) {\n this.remove(node);\n return true;\n }\n return super.add(node, normalizedValue.toString());\n }\n\n canAdd(node: HTMLElement, value: string) {\n return super.canAdd(node, value) || super.canAdd(node, parseInt(value, 10));\n }\n\n value(node: HTMLElement) {\n return parseInt(super.value(node), 10) || undefined; // Don't return NaN\n }\n}\n\nconst IndentClass = new IndentAttributor('indent', 'ql-indent', {\n scope: Scope.BLOCK,\n // @ts-expect-error\n whitelist: [1, 2, 3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AAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AACpC,CAAC,CAAC;AAEF,eAAeH,WAAW","ignoreList":[]}

View File

@@ -0,0 +1,6 @@
import Bold from './bold.js';
declare class Italic extends Bold {
static blotName: string;
static tagName: string[];
}
export default Italic;

View File

@@ -0,0 +1,7 @@
import Bold from './bold.js';
class Italic extends Bold {
static blotName = 'italic';
static tagName = ['EM', 'I'];
}
export default Italic;
//# sourceMappingURL=italic.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"italic.js","names":["Bold","Italic","blotName","tagName"],"sources":["../../src/formats/italic.ts"],"sourcesContent":["import Bold from './bold.js';\n\nclass Italic extends Bold {\n static blotName = 'italic';\n static tagName = ['EM', 'I'];\n}\n\nexport default Italic;\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,WAAW;AAE5B,MAAMC,MAAM,SAASD,IAAI,CAAC;EACxB,OAAOE,QAAQ,GAAG,QAAQ;EAC1B,OAAOC,OAAO,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC;AAC9B;AAEA,eAAeF,MAAM","ignoreList":[]}

13
public/assets/quill/formats/link.d.ts vendored Normal file
View File

@@ -0,0 +1,13 @@
import Inline from '../blots/inline.js';
declare class Link extends Inline {
static blotName: string;
static tagName: string;
static SANITIZED_URL: string;
static PROTOCOL_WHITELIST: string[];
static create(value: string): HTMLElement;
static formats(domNode: HTMLElement): string | null;
static sanitize(url: string): string;
format(name: string, value: unknown): void;
}
declare function sanitize(url: string, protocols: string[]): boolean;
export { Link as default, sanitize };

View File

@@ -0,0 +1,36 @@
import Inline from '../blots/inline.js';
class Link extends Inline {
static blotName = 'link';
static tagName = 'A';
static SANITIZED_URL = 'about:blank';
static PROTOCOL_WHITELIST = ['http', 'https', 'mailto', 'tel', 'sms'];
static create(value) {
const node = super.create(value);
node.setAttribute('href', this.sanitize(value));
node.setAttribute('rel', 'noopener noreferrer');
node.setAttribute('target', '_blank');
return node;
}
static formats(domNode) {
return domNode.getAttribute('href');
}
static sanitize(url) {
return sanitize(url, this.PROTOCOL_WHITELIST) ? url : this.SANITIZED_URL;
}
format(name, value) {
if (name !== this.statics.blotName || !value) {
super.format(name, value);
} else {
// @ts-expect-error
this.domNode.setAttribute('href', this.constructor.sanitize(value));
}
}
}
function sanitize(url, protocols) {
const anchor = document.createElement('a');
anchor.href = url;
const protocol = anchor.href.slice(0, anchor.href.indexOf(':'));
return protocols.indexOf(protocol) > -1;
}
export { Link as default, sanitize };
//# sourceMappingURL=link.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"link.js","names":["Inline","Link","blotName","tagName","SANITIZED_URL","PROTOCOL_WHITELIST","create","value","node","setAttribute","sanitize","formats","domNode","getAttribute","url","format","name","statics","constructor","protocols","anchor","document","createElement","href","protocol","slice","indexOf","default"],"sources":["../../src/formats/link.ts"],"sourcesContent":["import Inline from '../blots/inline.js';\n\nclass Link extends Inline {\n static blotName = 'link';\n static tagName = 'A';\n static SANITIZED_URL = 'about:blank';\n static PROTOCOL_WHITELIST = ['http', 'https', 'mailto', 'tel', 'sms'];\n\n static create(value: string) {\n const node = super.create(value) as HTMLElement;\n node.setAttribute('href', this.sanitize(value));\n node.setAttribute('rel', 'noopener noreferrer');\n node.setAttribute('target', '_blank');\n return node;\n }\n\n static formats(domNode: HTMLElement) {\n return domNode.getAttribute('href');\n }\n\n static sanitize(url: string) {\n return sanitize(url, this.PROTOCOL_WHITELIST) ? url : this.SANITIZED_URL;\n }\n\n format(name: string, value: unknown) {\n if (name !== this.statics.blotName || !value) {\n super.format(name, value);\n } else {\n // @ts-expect-error\n this.domNode.setAttribute('href', this.constructor.sanitize(value));\n }\n }\n}\n\nfunction sanitize(url: string, protocols: string[]) {\n const anchor = document.createElement('a');\n anchor.href = url;\n const protocol = anchor.href.slice(0, anchor.href.indexOf(':'));\n return protocols.indexOf(protocol) > -1;\n}\n\nexport { Link as default, sanitize };\n"],"mappings":"AAAA,OAAOA,MA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QAAQ,CAACC,aAAa,CAAC,GAAG,CAAC;EAC1CF,MAAM,CAACG,IAAI,GAAGT,GAAG;EACjB,MAAMU,QAAQ,GAAGJ,MAAM,CAACG,IAAI,CAACE,KAAK,CAAC,CAAC,EAAEL,MAAM,CAACG,IAAI,CAACG,OAAO,CAAC,GAAG,CAAC,CAAC;EAC/D,OAAOP,SAAS,CAACO,OAAO,CAACF,QAAQ,CAAC,GAAG,CAAC,CAAC;AACzC;AAEA,SAASvB,IAAI,IAAI0B,OAAO,EAAEjB,QAAQ","ignoreList":[]}

13
public/assets/quill/formats/list.d.ts vendored Normal file
View File

@@ -0,0 +1,13 @@
import Block from '../blots/block.js';
import Container from '../blots/container.js';
import type Scroll from '../blots/scroll.js';
declare class ListContainer extends Container {
}
declare class ListItem extends Block {
static create(value: string): HTMLElement;
static formats(domNode: HTMLElement): string | undefined;
static register(): void;
constructor(scroll: Scroll, domNode: HTMLElement);
format(name: string, value: string): void;
}
export { ListContainer, ListItem as default };

View File

@@ -0,0 +1,50 @@
import Block from '../blots/block.js';
import Container from '../blots/container.js';
import Quill from '../core/quill.js';
class ListContainer extends Container {}
ListContainer.blotName = 'list-container';
ListContainer.tagName = 'OL';
class ListItem extends Block {
static create(value) {
const node = super.create();
node.setAttribute('data-list', value);
return node;
}
static formats(domNode) {
return domNode.getAttribute('data-list') || undefined;
}
static register() {
Quill.register(ListContainer);
}
constructor(scroll, domNode) {
super(scroll, domNode);
const ui = domNode.ownerDocument.createElement('span');
const listEventHandler = e => {
if (!scroll.isEnabled()) return;
const format = this.statics.formats(domNode, scroll);
if (format === 'checked') {
this.format('list', 'unchecked');
e.preventDefault();
} else if (format === 'unchecked') {
this.format('list', 'checked');
e.preventDefault();
}
};
ui.addEventListener('mousedown', listEventHandler);
ui.addEventListener('touchstart', listEventHandler);
this.attachUI(ui);
}
format(name, value) {
if (name === this.statics.blotName && value) {
this.domNode.setAttribute('data-list', value);
} else {
super.format(name, value);
}
}
}
ListItem.blotName = 'list';
ListItem.tagName = 'LI';
ListContainer.allowedChildren = [ListItem];
ListItem.requiredContainer = ListContainer;
export { ListContainer, ListItem as default };
//# sourceMappingURL=list.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"list.js","names":["Block","Container","Quill","ListContainer","blotName","tagName","ListItem","create","value","node","setAttribute","formats","domNode","getAttribute","undefined","register","constructor","scroll","ui","ownerDocument","createElement","listEventHandler","e","isEnabled","format","statics","preventDefault","addEventListener","attachUI","name","allowedChildren","requiredContainer","default"],"sources":["../../src/formats/list.ts"],"sourcesContent":["import Block from '../blots/block.js';\nimport Container from '../blots/container.js';\nimport type Scroll from '../blots/scroll.js';\nimport Quill from '../core/quill.js';\n\nclass ListContainer extends Container {}\nListContainer.blotName = 'list-container';\nListContainer.tagName = 'OL';\n\nclass ListItem extends Block {\n static create(value: string) {\n const node = super.create() as HTMLElement;\n node.setAttribute('data-list', value);\n return node;\n }\n\n static formats(domNode: HTMLElement) {\n return domNode.getAttribute('data-list') || undefined;\n }\n\n static register() {\n Quill.register(ListContainer);\n }\n\n constructor(scroll: Scroll, domNode: HTMLElement) {\n super(scroll, domNode);\n const ui = domNode.ownerDocument.createElement('span');\n const listEventHandler = (e: Event) => {\n if (!scroll.isEnabled()) return;\n const format = this.statics.formats(domNode, scroll);\n if (format === 'checked') {\n this.format('list', 'unchecked');\n e.preventDefault();\n } else if (format === 'unchecked') {\n this.format('list', 'checked');\n e.preventDefault();\n }\n };\n ui.addEventListener('mousedown', listEventHandler);\n ui.addEventListener('touchstart', listEventHandler);\n this.attachUI(ui);\n }\n\n format(name: string, value: string) {\n if (name === this.statics.blotName && value) {\n this.domNode.setAttribute('data-list', value);\n } else {\n super.format(name, value);\n }\n }\n}\nListItem.blotName = 'list';\nListItem.tagName = 'LI';\n\nListContainer.allowedChildren = [ListItem];\nListItem.requiredContainer = ListContainer;\n\nexport { ListContainer, ListItem as default };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,mBAAmB;AACrC,OAAOC,SAAS,MA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AAgB,CAAC,WAAW,EAAEN,gBAAgB,CAAC;IAClDH,EAAE,CAACS,gBAAgB,CAAC,YAAY,EAAEN,gBAAgB,CAAC;IACnD,IAAI,CAACO,QAAQ,CAACV,EAAE,CAAC;EACnB;EAEAM,MAAMA,CAACK,IAAY,EAAErB,KAAa,EAAE;IAClC,IAAIqB,IAAI,KAAK,IAAI,CAACJ,OAAO,CAACrB,QAAQ,IAAII,KAAK,EAAE;MAC3C,IAAI,CAACI,OAAO,CAACF,YAAY,CAAC,WAAW,EAAEF,KAAK,CAAC;IAC/C,CAAC,MAAM;MACL,KAAK,CAACgB,MAAM,CAACK,IAAI,EAAErB,KAAK,CAAC;IAC3B;EACF;AACF;AACAF,QAAQ,CAACF,QAAQ,GAAG,MAAM;AAC1BE,QAAQ,CAACD,OAAO,GAAG,IAAI;AAEvBF,aAAa,CAAC2B,eAAe,GAAG,CAACxB,QAAQ,CAAC;AAC1CA,QAAQ,CAACyB,iBAAiB,GAAG5B,aAAa;AAE1C,SAASA,aAAa,EAAEG,QAAQ,IAAI0B,OAAO","ignoreList":[]}

View File

@@ -0,0 +1,8 @@
import Inline from '../blots/inline.js';
declare class Script extends Inline {
static blotName: string;
static tagName: string[];
static create(value: 'super' | 'sub' | (string & {})): HTMLElement;
static formats(domNode: HTMLElement): "super" | "sub" | undefined;
}
export default Script;

View File

@@ -0,0 +1,21 @@
import Inline from '../blots/inline.js';
class Script extends Inline {
static blotName = 'script';
static tagName = ['SUB', 'SUP'];
static create(value) {
if (value === 'super') {
return document.createElement('sup');
}
if (value === 'sub') {
return document.createElement('sub');
}
return super.create(value);
}
static formats(domNode) {
if (domNode.tagName === 'SUB') return 'sub';
if (domNode.tagName === 'SUP') return 'super';
return undefined;
}
}
export default Script;
//# sourceMappingURL=script.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"script.js","names":["Inline","Script","blotName","tagName","create","value","document","createElement","formats","domNode","undefined"],"sources":["../../src/formats/script.ts"],"sourcesContent":["import Inline from '../blots/inline.js';\n\nclass Script extends Inline {\n static blotName = 'script';\n static tagName = ['SUB', 'SUP'];\n\n static create(value: 'super' | 'sub' | (string & {})) {\n if (value === 'super') {\n return document.createElement('sup');\n }\n if (value === 'sub') {\n return document.createElement('sub');\n }\n return super.create(value);\n }\n\n static formats(domNode: HTMLElement) {\n if (domNode.tagName === 'SUB') return 'sub';\n if (domNode.tagName === 'SUP') return 'super';\n return undefined;\n }\n}\n\nexport default Script;\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,oBAAoB;AAEvC,MAAMC,MAAM,SAASD,MAAM,CAAC;EAC1B,OAAOE,QAAQ,GAAG,QAAQ;EAC1B,OAAOC,OAAO,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC;EAE/B,OAAOC,MAAMA,CAACC,KAAsC,EAAE;IACpD,IAAIA,KAAK,KAAK,OAAO,EAAE;MACrB,OAAOC,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC;IACtC;IACA,IAAIF,KAAK,KAAK,KAAK,EAAE;MACnB,OAAOC,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC;IACtC;IACA,OAAO,KAAK,CAACH,MAAM,CAACC,KAAK,CAAC;EAC5B;EAEA,OAAOG,OAAOA,CAACC,OAAoB,EAAE;IACnC,IAAIA,OAAO,CAACN,OAAO,KAAK,KAAK,EAAE,OAAO,KAAK;IAC3C,IAAIM,OAAO,CAACN,OAAO,KAAK,KAAK,EAAE,OAAO,OAAO;IAC7C,OAAOO,SAAS;EAClB;AACF;AAEA,eAAeT,MAAM","ignoreList":[]}

4
public/assets/quill/formats/size.d.ts vendored Normal file
View File

@@ -0,0 +1,4 @@
import { ClassAttributor, StyleAttributor } from 'parchment';
declare const SizeClass: ClassAttributor;
declare const SizeStyle: StyleAttributor;
export { SizeClass, SizeStyle };

View File

@@ -0,0 +1,11 @@
import { ClassAttributor, Scope, StyleAttributor } from 'parchment';
const SizeClass = new ClassAttributor('size', 'ql-size', {
scope: Scope.INLINE,
whitelist: ['small', 'large', 'huge']
});
const SizeStyle = new StyleAttributor('size', 'font-size', {
scope: Scope.INLINE,
whitelist: ['10px', '18px', '32px']
});
export { SizeClass, SizeStyle };
//# sourceMappingURL=size.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"size.js","names":["ClassAttributor","Scope","StyleAttributor","SizeClass","scope","INLINE","whitelist","SizeStyle"],"sources":["../../src/formats/size.ts"],"sourcesContent":["import { ClassAttributor, Scope, StyleAttributor } from 'parchment';\n\nconst SizeClass = new ClassAttributor('size', 'ql-size', {\n scope: Scope.INLINE,\n whitelist: ['small', 'large', 'huge'],\n});\nconst SizeStyle = new StyleAttributor('size', 'font-size', {\n scope: Scope.INLINE,\n whitelist: ['10px', '18px', '32px'],\n});\n\nexport { SizeClass, SizeStyle };\n"],"mappings":"AAAA,SAASA,eAAe,EAAEC,KAAK,EAAEC,eAAe,QAAQ,WAAW;AAEnE,MAAMC,SAAS,GAAG,IAAIH,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE;EACvDI,KAAK,EAAEH,KAAK,CAACI,MAAM;EACnBC,SAAS,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM;AACtC,CAAC,CAAC;AACF,MAAMC,SAAS,GAAG,IAAIL,eAAe,CAAC,MAAM,EAAE,WAAW,EAAE;EACzDE,KAAK,EAAEH,KAAK,CAACI,MAAM;EACnBC,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM;AACpC,CAAC,CAAC;AAEF,SAASH,SAAS,EAAEI,SAAS","ignoreList":[]}

View File

@@ -0,0 +1,6 @@
import Bold from './bold.js';
declare class Strike extends Bold {
static blotName: string;
static tagName: string[];
}
export default Strike;

View File

@@ -0,0 +1,7 @@
import Bold from './bold.js';
class Strike extends Bold {
static blotName = 'strike';
static tagName = ['S', 'STRIKE'];
}
export default Strike;
//# sourceMappingURL=strike.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"strike.js","names":["Bold","Strike","blotName","tagName"],"sources":["../../src/formats/strike.ts"],"sourcesContent":["import Bold from './bold.js';\n\nclass Strike extends Bold {\n static blotName = 'strike';\n static tagName = ['S', 'STRIKE'];\n}\n\nexport default Strike;\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,WAAW;AAE5B,MAAMC,MAAM,SAASD,IAAI,CAAC;EACxB,OAAOE,QAAQ,GAAG,QAAQ;EAC1B,OAAOC,OAAO,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC;AAClC;AAEA,eAAeF,MAAM","ignoreList":[]}

45
public/assets/quill/formats/table.d.ts vendored Normal file
View File

@@ -0,0 +1,45 @@
import type { LinkedList } from 'parchment';
import Block from '../blots/block.js';
import Container from '../blots/container.js';
declare class TableCell extends Block {
static blotName: string;
static tagName: string;
static create(value: string): HTMLElement;
static formats(domNode: HTMLElement): string | null | undefined;
next: this | null;
cellOffset(): number;
format(name: string, value: string): void;
row(): TableRow;
rowOffset(): number;
table(): import("parchment").Parent;
}
declare class TableRow extends Container {
static blotName: string;
static tagName: string;
children: LinkedList<TableCell>;
next: this | null;
checkMerge(): boolean;
optimize(context: {
[key: string]: any;
}): void;
rowOffset(): number;
table(): import("parchment").Parent;
}
declare class TableBody extends Container {
static blotName: string;
static tagName: string;
children: LinkedList<TableRow>;
}
declare class TableContainer extends Container {
static blotName: string;
static tagName: string;
children: LinkedList<TableBody>;
balanceCells(): void;
cells(column: number): any[];
deleteColumn(index: number): void;
insertColumn(index: number): void;
insertRow(index: number): void;
rows(): any[];
}
declare function tableId(): string;
export { TableCell, TableRow, TableBody, TableContainer, tableId };

View File

@@ -0,0 +1,176 @@
import Block from '../blots/block.js';
import Container from '../blots/container.js';
class TableCell extends Block {
static blotName = 'table';
static tagName = 'TD';
static create(value) {
const node = super.create();
if (value) {
node.setAttribute('data-row', value);
} else {
node.setAttribute('data-row', tableId());
}
return node;
}
static formats(domNode) {
if (domNode.hasAttribute('data-row')) {
return domNode.getAttribute('data-row');
}
return undefined;
}
cellOffset() {
if (this.parent) {
return this.parent.children.indexOf(this);
}
return -1;
}
format(name, value) {
if (name === TableCell.blotName && value) {
this.domNode.setAttribute('data-row', value);
} else {
super.format(name, value);
}
}
row() {
return this.parent;
}
rowOffset() {
if (this.row()) {
return this.row().rowOffset();
}
return -1;
}
table() {
return this.row() && this.row().table();
}
}
class TableRow extends Container {
static blotName = 'table-row';
static tagName = 'TR';
checkMerge() {
// @ts-expect-error
if (super.checkMerge() && this.next.children.head != null) {
// @ts-expect-error
const thisHead = this.children.head.formats();
// @ts-expect-error
const thisTail = this.children.tail.formats();
// @ts-expect-error
const nextHead = this.next.children.head.formats();
// @ts-expect-error
const nextTail = this.next.children.tail.formats();
return thisHead.table === thisTail.table && thisHead.table === nextHead.table && thisHead.table === nextTail.table;
}
return false;
}
optimize(context) {
super.optimize(context);
this.children.forEach(child => {
if (child.next == null) return;
const childFormats = child.formats();
const nextFormats = child.next.formats();
if (childFormats.table !== nextFormats.table) {
const next = this.splitAfter(child);
if (next) {
// @ts-expect-error TODO: parameters of optimize() should be a optional
next.optimize();
}
// We might be able to merge with prev now
if (this.prev) {
// @ts-expect-error TODO: parameters of optimize() should be a optional
this.prev.optimize();
}
}
});
}
rowOffset() {
if (this.parent) {
return this.parent.children.indexOf(this);
}
return -1;
}
table() {
return this.parent && this.parent.parent;
}
}
class TableBody extends Container {
static blotName = 'table-body';
static tagName = 'TBODY';
}
class TableContainer extends Container {
static blotName = 'table-container';
static tagName = 'TABLE';
balanceCells() {
const rows = this.descendants(TableRow);
const maxColumns = rows.reduce((max, row) => {
return Math.max(row.children.length, max);
}, 0);
rows.forEach(row => {
new Array(maxColumns - row.children.length).fill(0).forEach(() => {
let value;
if (row.children.head != null) {
value = TableCell.formats(row.children.head.domNode);
}
const blot = this.scroll.create(TableCell.blotName, value);
row.appendChild(blot);
// @ts-expect-error TODO: parameters of optimize() should be a optional
blot.optimize(); // Add break blot
});
});
}
cells(column) {
return this.rows().map(row => row.children.at(column));
}
deleteColumn(index) {
// @ts-expect-error
const [body] = this.descendant(TableBody);
if (body == null || body.children.head == null) return;
body.children.forEach(row => {
const cell = row.children.at(index);
if (cell != null) {
cell.remove();
}
});
}
insertColumn(index) {
// @ts-expect-error
const [body] = this.descendant(TableBody);
if (body == null || body.children.head == null) return;
body.children.forEach(row => {
const ref = row.children.at(index);
// @ts-expect-error
const value = TableCell.formats(row.children.head.domNode);
const cell = this.scroll.create(TableCell.blotName, value);
row.insertBefore(cell, ref);
});
}
insertRow(index) {
// @ts-expect-error
const [body] = this.descendant(TableBody);
if (body == null || body.children.head == null) return;
const id = tableId();
const row = this.scroll.create(TableRow.blotName);
body.children.head.children.forEach(() => {
const cell = this.scroll.create(TableCell.blotName, id);
row.appendChild(cell);
});
const ref = body.children.at(index);
body.insertBefore(row, ref);
}
rows() {
const body = this.children.head;
if (body == null) return [];
return body.children.map(row => row);
}
}
TableContainer.allowedChildren = [TableBody];
TableBody.requiredContainer = TableContainer;
TableBody.allowedChildren = [TableRow];
TableRow.requiredContainer = TableBody;
TableRow.allowedChildren = [TableCell];
TableCell.requiredContainer = TableRow;
function tableId() {
const id = Math.random().toString(36).slice(2, 6);
return `row-${id}`;
}
export { TableCell, TableRow, TableBody, TableContainer, tableId };
//# sourceMappingURL=table.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,6 @@
import Inline from '../blots/inline.js';
declare class Underline extends Inline {
static blotName: string;
static tagName: string;
}
export default Underline;

View File

@@ -0,0 +1,7 @@
import Inline from '../blots/inline.js';
class Underline extends Inline {
static blotName = 'underline';
static tagName = 'U';
}
export default Underline;
//# sourceMappingURL=underline.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"underline.js","names":["Inline","Underline","blotName","tagName"],"sources":["../../src/formats/underline.ts"],"sourcesContent":["import Inline from '../blots/inline.js';\n\nclass Underline extends Inline {\n static blotName = 'underline';\n static tagName = 'U';\n}\n\nexport default Underline;\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,oBAAoB;AAEvC,MAAMC,SAAS,SAASD,MAAM,CAAC;EAC7B,OAAOE,QAAQ,GAAG,WAAW;EAC7B,OAAOC,OAAO,GAAG,GAAG;AACtB;AAEA,eAAeF,SAAS","ignoreList":[]}

14
public/assets/quill/formats/video.d.ts vendored Normal file
View File

@@ -0,0 +1,14 @@
import { BlockEmbed } from '../blots/block.js';
declare class Video extends BlockEmbed {
static blotName: string;
static className: string;
static tagName: string;
static create(value: string): Element;
static formats(domNode: Element): Record<string, string | null>;
static sanitize(url: string): string;
static value(domNode: Element): string | null;
domNode: HTMLVideoElement;
format(name: string, value: string): void;
html(): string;
}
export default Video;

View File

@@ -0,0 +1,48 @@
import { BlockEmbed } from '../blots/block.js';
import Link from './link.js';
const ATTRIBUTES = ['height', 'width'];
class Video extends BlockEmbed {
static blotName = 'video';
static className = 'ql-video';
static tagName = 'IFRAME';
static create(value) {
const node = super.create(value);
node.setAttribute('frameborder', '0');
node.setAttribute('allowfullscreen', 'true');
node.setAttribute('src', this.sanitize(value));
return node;
}
static formats(domNode) {
return ATTRIBUTES.reduce((formats, attribute) => {
if (domNode.hasAttribute(attribute)) {
formats[attribute] = domNode.getAttribute(attribute);
}
return formats;
}, {});
}
static sanitize(url) {
return Link.sanitize(url);
}
static value(domNode) {
return domNode.getAttribute('src');
}
format(name, value) {
if (ATTRIBUTES.indexOf(name) > -1) {
if (value) {
this.domNode.setAttribute(name, value);
} else {
this.domNode.removeAttribute(name);
}
} else {
super.format(name, value);
}
}
html() {
const {
video
} = this.value();
return `<a href="${video}">${video}</a>`;
}
}
export default Video;
//# sourceMappingURL=video.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"video.js","names":["BlockEmbed","Link","ATTRIBUTES","Video","blotName","className","tagName","create","value","node","setAttribute","sanitize","formats","domNode","reduce","attribute","hasAttribute","getAttribute","url","format","name","indexOf","removeAttribute","html","video"],"sources":["../../src/formats/video.ts"],"sourcesContent":["import { BlockEmbed } from '../blots/block.js';\nimport Link from './link.js';\n\nconst ATTRIBUTES = ['height', 'width'];\n\nclass Video extends BlockEmbed {\n static blotName = 'video';\n static className = 'ql-video';\n static tagName = 'IFRAME';\n\n static create(value: string) {\n const node = super.create(value) as Element;\n node.setAttribute('frameborder', '0');\n node.setAttribute('allowfullscreen', 'true');\n node.setAttribute('src', this.sanitize(value));\n return node;\n }\n\n static formats(domNode: Element) {\n return ATTRIBUTES.reduce(\n (formats: Record<string, string | null>, attribute) => {\n if (domNode.hasAttribute(attribute)) {\n formats[attribute] = domNode.getAttribute(attribute);\n }\n return formats;\n },\n {},\n );\n }\n\n static sanitize(url: string) {\n return Link.sanitize(url);\n }\n\n static value(domNode: Element) {\n return domNode.getAttribute('src');\n }\n\n domNode: HTMLVideoElement;\n\n format(name: string, value: string) {\n if (ATTRIBUTES.indexOf(name) > -1) {\n if (value) {\n this.domNode.setAttribute(name, value);\n } else {\n this.domNode.removeAttribute(name);\n }\n } else {\n super.format(name, value);\n }\n }\n\n html() {\n const { video } = this.value();\n return `<a href=\"${video}\">${video}</a>`;\n }\n}\n\nexport default Video;\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,mBAAmB;AAC9C,OAAOC,IAAI,MAAM,WAAW;AAE5B,MAAMC,UAAU,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC;AAEtC,MAAMC,KAAK,SAASH,UAAU,CAAC;EAC7B,OAAOI,QAAQ,GAAG,OAAO;EACzB,OAAOC,SAAS,GAAG,UAAU;EAC7B,OAAOC,OAAO,GAAG,QAAQ;EAEzB,OAAOC,MAAMA,CAACC,KAAa,EAAE;IAC3B,MAAMC,IAAI,GAAG,KAAK,CAACF,MAAM,CAACC,KAAK,CAAY;IAC3CC,IAAI,CAACC,YAAY,CAAC,aAAa,EAAE,GAAG,CAAC;IACrCD,IAAI,CAACC,YAAY,CAAC,iBAAiB,EAAE,MAAM,CAAC;IAC5CD,IAAI,CAACC,YAAY,CAAC,KAAK,EAAE,IAAI,CAACC,QAAQ,CAACH,KAAK,CAAC,CAAC;IAC9C,OAAOC,IAAI;EACb;EA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