1 |
- {"version":3,"file":"toolbar.js","names":["Delta","EmbedBlot","Scope","Quill","logger","Module","debug","Toolbar","constructor","quill","options","Array","isArray","container","document","createElement","setAttribute","addControls","parentNode","insertBefore","querySelector","HTMLElement","error","classList","add","controls","handlers","Object","keys","forEach","format","handler","addHandler","from","querySelectorAll","input","attach","on","events","EDITOR_CHANGE","range","selection","getRange","update","find","className","indexOf","slice","length","tagName","scroll","query","warn","eventName","addEventListener","e","value","selectedIndex","selected","hasAttribute","contains","preventDefault","focus","call","prototype","prompt","updateContents","retain","index","delete","insert","sources","USER","push","formats","getFormat","pair","option","replace","remove","isActive","getAttribute","toString","toggle","DEFAULTS","addButton","appendChild","groups","group","control","addSelect","values","String","clean","getSelection","name","INLINE","removeFormat","direction","align","indent","parseInt","modifier","link","list","default"],"sources":["../../src/modules/toolbar.ts"],"sourcesContent":["import Delta from 'quill-delta';\nimport { EmbedBlot, Scope } from 'parchment';\nimport Quill from '../core/quill.js';\nimport logger from '../core/logger.js';\nimport Module from '../core/module.js';\nimport type { Range } from '../core/selection.js';\n\nconst debug = logger('quill:toolbar');\n\ntype Handler = (this: Toolbar, value: any) => void;\n\nexport type ToolbarConfig = Array<\n string[] | Array<string | Record<string, unknown>>\n>;\nexport interface ToolbarProps {\n container?: HTMLElement | ToolbarConfig | null;\n handlers?: Record<string, Handler>;\n option?: number;\n module?: boolean;\n theme?: boolean;\n}\n\nclass Toolbar extends Module<ToolbarProps> {\n static DEFAULTS: ToolbarProps;\n\n container?: HTMLElement | null;\n controls: [string, HTMLElement][];\n handlers: Record<string, Handler>;\n\n constructor(quill: Quill, options: Partial<ToolbarProps>) {\n super(quill, options);\n if (Array.isArray(this.options.container)) {\n const container = document.createElement('div');\n container.setAttribute('role', 'toolbar');\n addControls(container, this.options.container);\n quill.container?.parentNode?.insertBefore(container, quill.container);\n this.container = container;\n } else if (typeof this.options.container === 'string') {\n this.container = document.querySelector(this.options.container);\n } else {\n this.container = this.options.container;\n }\n if (!(this.container instanceof HTMLElement)) {\n debug.error('Container required for toolbar', this.options);\n return;\n }\n this.container.classList.add('ql-toolbar');\n this.controls = [];\n this.handlers = {};\n if (this.options.handlers) {\n Object.keys(this.options.handlers).forEach((format) => {\n const handler = this.options.handlers?.[format];\n if (handler) {\n this.addHandler(format, handler);\n }\n });\n }\n Array.from(this.container.querySelectorAll('button, select')).forEach(\n (input) => {\n // @ts-expect-error\n this.attach(input);\n },\n );\n this.quill.on(Quill.events.EDITOR_CHANGE, () => {\n const [range] = this.quill.selection.getRange(); // quill.getSelection triggers update\n this.update(range);\n });\n }\n\n addHandler(format: string, handler: Handler) {\n this.handlers[format] = handler;\n }\n\n attach(input: HTMLElement) {\n let format = Array.from(input.classList).find((className) => {\n return className.indexOf('ql-') === 0;\n });\n if (!format) return;\n format = format.slice('ql-'.length);\n if (input.tagName === 'BUTTON') {\n input.setAttribute('type', 'button');\n }\n if (\n this.handlers[format] == null &&\n this.quill.scroll.query(format) == null\n ) {\n debug.warn('ignoring attaching to nonexistent format', format, input);\n return;\n }\n const eventName = input.tagName === 'SELECT' ? 'change' : 'click';\n input.addEventListener(eventName, (e) => {\n let value;\n if (input.tagName === 'SELECT') {\n // @ts-expect-error\n if (input.selectedIndex < 0) return;\n // @ts-expect-error\n const selected = input.options[input.selectedIndex];\n if (selected.hasAttribute('selected')) {\n value = false;\n } else {\n value = selected.value || false;\n }\n } else {\n if (input.classList.contains('ql-active')) {\n value = false;\n } else {\n // @ts-expect-error\n value = input.value || !input.hasAttribute('value');\n }\n e.preventDefault();\n }\n this.quill.focus();\n const [range] = this.quill.selection.getRange();\n if (this.handlers[format] != null) {\n this.handlers[format].call(this, value);\n } else if (\n // @ts-expect-error\n this.quill.scroll.query(format).prototype instanceof EmbedBlot\n ) {\n value = prompt(`Enter ${format}`); // eslint-disable-line no-alert\n if (!value) return;\n this.quill.updateContents(\n new Delta()\n // @ts-expect-error Fix me later\n .retain(range.index)\n // @ts-expect-error Fix me later\n .delete(range.length)\n .insert({ [format]: value }),\n Quill.sources.USER,\n );\n } else {\n this.quill.format(format, value, Quill.sources.USER);\n }\n this.update(range);\n });\n this.controls.push([format, input]);\n }\n\n update(range: Range | null) {\n const formats = range == null ? {} : this.quill.getFormat(range);\n this.controls.forEach((pair) => {\n const [format, input] = pair;\n if (input.tagName === 'SELECT') {\n let option: HTMLOptionElement | null = null;\n if (range == null) {\n option = null;\n } else if (formats[format] == null) {\n option = input.querySelector('option[selected]');\n } else if (!Array.isArray(formats[format])) {\n let value = formats[format];\n if (typeof value === 'string') {\n value = value.replace(/\"/g, '\\\\\"');\n }\n option = input.querySelector(`option[value=\"${value}\"]`);\n }\n if (option == null) {\n // @ts-expect-error TODO fix me later\n input.value = ''; // TODO make configurable?\n // @ts-expect-error TODO fix me later\n input.selectedIndex = -1;\n } else {\n option.selected = true;\n }\n } else if (range == null) {\n input.classList.remove('ql-active');\n input.setAttribute('aria-pressed', 'false');\n } else if (input.hasAttribute('value')) {\n // both being null should match (default values)\n // '1' should match with 1 (headers)\n const value = formats[format] as boolean | number | string | object;\n const isActive =\n value === input.getAttribute('value') ||\n (value != null && value.toString() === input.getAttribute('value')) ||\n (value == null && !input.getAttribute('value'));\n input.classList.toggle('ql-active', isActive);\n input.setAttribute('aria-pressed', isActive.toString());\n } else {\n const isActive = formats[format] != null;\n input.classList.toggle('ql-active', isActive);\n input.setAttribute('aria-pressed', isActive.toString());\n }\n });\n }\n}\nToolbar.DEFAULTS = {};\n\nfunction addButton(container: HTMLElement, format: string, value?: string) {\n const input = document.createElement('button');\n input.setAttribute('type', 'button');\n input.classList.add(`ql-${format}`);\n input.setAttribute('aria-pressed', 'false');\n if (value != null) {\n input.value = value;\n input.setAttribute('aria-label', `${format}: ${value}`);\n } else {\n input.setAttribute('aria-label', format);\n }\n container.appendChild(input);\n}\n\nfunction addControls(\n container: HTMLElement,\n groups:\n | (string | Record<string, unknown>)[][]\n | (string | Record<string, unknown>)[],\n) {\n if (!Array.isArray(groups[0])) {\n // @ts-expect-error\n groups = [groups];\n }\n groups.forEach((controls: any) => {\n const group = document.createElement('span');\n group.classList.add('ql-formats');\n controls.forEach((control: any) => {\n if (typeof control === 'string') {\n addButton(group, control);\n } else {\n const format = Object.keys(control)[0];\n const value = control[format];\n if (Array.isArray(value)) {\n addSelect(group, format, value);\n } else {\n addButton(group, format, value);\n }\n }\n });\n container.appendChild(group);\n });\n}\n\nfunction addSelect(\n container: HTMLElement,\n format: string,\n values: Array<string | boolean>,\n) {\n const input = document.createElement('select');\n input.classList.add(`ql-${format}`);\n values.forEach((value) => {\n const option = document.createElement('option');\n if (value !== false) {\n option.setAttribute('value', String(value));\n } else {\n option.setAttribute('selected', 'selected');\n }\n input.appendChild(option);\n });\n container.appendChild(input);\n}\n\nToolbar.DEFAULTS = {\n container: null,\n handlers: {\n clean() {\n const range = this.quill.getSelection();\n if (range == null) return;\n if (range.length === 0) {\n const formats = this.quill.getFormat();\n Object.keys(formats).forEach((name) => {\n // Clean functionality in existing apps only clean inline formats\n if (this.quill.scroll.query(name, Scope.INLINE) != null) {\n this.quill.format(name, false, Quill.sources.USER);\n }\n });\n } else {\n this.quill.removeFormat(range.index, range.length, Quill.sources.USER);\n }\n },\n direction(value) {\n const { align } = this.quill.getFormat();\n if (value === 'rtl' && align == null) {\n this.quill.format('align', 'right', Quill.sources.USER);\n } else if (!value && align === 'right') {\n this.quill.format('align', false, Quill.sources.USER);\n }\n this.quill.format('direction', value, Quill.sources.USER);\n },\n indent(value) {\n const range = this.quill.getSelection();\n // @ts-expect-error\n const formats = this.quill.getFormat(range);\n // @ts-expect-error\n const indent = parseInt(formats.indent || 0, 10);\n if (value === '+1' || value === '-1') {\n let modifier = value === '+1' ? 1 : -1;\n if (formats.direction === 'rtl') modifier *= -1;\n this.quill.format('indent', indent + modifier, Quill.sources.USER);\n }\n },\n link(value) {\n if (value === true) {\n value = prompt('Enter link URL:'); // eslint-disable-line no-alert\n }\n this.quill.format('link', value, Quill.sources.USER);\n },\n list(value) {\n const range = this.quill.getSelection();\n // @ts-expect-error\n const formats = this.quill.getFormat(range);\n if (value === 'check') {\n if (formats.list === 'checked' || formats.list === 'unchecked') {\n this.quill.format('list', false, Quill.sources.USER);\n } else {\n this.quill.format('list', 'unchecked', Quill.sources.USER);\n }\n } else {\n this.quill.format('list', value, Quill.sources.USER);\n }\n },\n },\n};\n\nexport { Toolbar as default, addControls };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,aAAa;AAC/B,SAASC,SAAS,EAAEC,KAAK,QAAQ,WAAW;AAC5C,OAAOC,KAAK,MAAM,kBAAkB;AACpC,OAAOC,MAAM,MAAM,mBAAmB;AACtC,OAAOC,MAAM,MAAM,mBAAmB;AAGtC,MAAMC,KAAK,GAAGF,MAAM,CAAC,eAAe,CAAC;AAerC,MAAMG,OAAO,SAASF,MAAM,CAAe;EAOzCG,WAAWA,CAACC,KAAY,EAAEC,OAA8B,EAAE;IACxD,KAAK,CAACD,KAAK,EAAEC,OAAO,CAAC;IACrB,IAAIC,KAAK,CAACC,OAAO,CAAC,IAAI,CAACF,OAAO,CAACG,SAAS,CAAC,EAAE;MACzC,MAAMA,SAAS,GAAGC,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC;MAC/CF,SAAS,CAACG,YAAY,CAAC,MAAM,EAAE,SAAS,CAAC;MACzCC,WAAW,CAACJ,SAAS,EAAE,IAAI,CAACH,OAAO,CAACG,SAAS,CAAC;MAC9CJ,KAAK,CAACI,SAAS,EAAEK,UAAU,EAAEC,YAAY,CAACN,SAAS,EAAEJ,KAAK,CAACI,SAAS,CAAC;MACrE,IAAI,CAACA,SAAS,GAAGA,SAAS;IAC5B,CAAC,MAAM,IAAI,OAAO,IAAI,CAACH,OAAO,CAACG,SAAS,KAAK,QAAQ,EAAE;MACrD,IAAI,CAACA,SAAS,GAAGC,QAAQ,CAACM,aAAa,CAAC,IAAI,CAACV,OAAO,CAACG,SAAS,CAAC;IACjE,CAAC,MAAM;MACL,IAAI,CAACA,SAAS,GAAG,IAAI,CAACH,O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