Comparing version 2.0.0-rc.3 to 2.0.0-rc.4
import Quill from './core/quill.js'; | ||
import type { DebugLevel, ExpandedQuillOptions, QuillOptions } from './core/quill.js'; | ||
import Delta, { Op, OpIterator, AttributeMap } from 'quill-delta'; | ||
export { Delta, Op, OpIterator, AttributeMap }; | ||
export type { DebugLevel, ExpandedQuillOptions, QuillOptions }; | ||
export default Quill; |
@@ -23,13 +23,33 @@ import * as Parchment from 'parchment'; | ||
declare const globalRegistry: Parchment.Registry; | ||
interface Options { | ||
/** | ||
* Options for initializing a Quill instance | ||
*/ | ||
export interface QuillOptions { | ||
theme?: string; | ||
debug?: DebugLevel | boolean; | ||
registry?: Parchment.Registry; | ||
/** | ||
* Whether to disable the editing | ||
* @default false | ||
*/ | ||
readOnly?: boolean; | ||
/** | ||
* Placeholder text to display when the editor is empty | ||
* @default "" | ||
*/ | ||
placeholder?: string; | ||
bounds?: HTMLElement | string | null; | ||
modules?: Record<string, unknown>; | ||
/** | ||
* A list of formats that are recognized and can exist within the editor contents. | ||
* `null` means all formats are allowed. | ||
* @default null | ||
*/ | ||
formats?: string[] | null; | ||
} | ||
interface ExpandedOptions extends Omit<Options, 'theme' | 'formats'> { | ||
/** | ||
* Similar to QuillOptions, but with all properties expanded to their default values, | ||
* and all selectors resolved to HTMLElements. | ||
*/ | ||
export interface ExpandedQuillOptions extends Omit<QuillOptions, 'theme' | 'formats'> { | ||
theme: ThemeConstructor; | ||
@@ -44,13 +64,13 @@ registry: Parchment.Registry; | ||
static DEFAULTS: { | ||
readonly bounds: null; | ||
readonly modules: { | ||
readonly clipboard: true; | ||
readonly keyboard: true; | ||
readonly history: true; | ||
readonly uploader: true; | ||
bounds: null; | ||
modules: { | ||
clipboard: boolean; | ||
keyboard: boolean; | ||
history: boolean; | ||
uploader: boolean; | ||
}; | ||
readonly placeholder: ""; | ||
readonly readOnly: false; | ||
readonly registry: Parchment.Registry; | ||
readonly theme: "default"; | ||
placeholder: string; | ||
readOnly: false; | ||
registry: Parchment.Registry; | ||
theme: string; | ||
}; | ||
@@ -91,3 +111,3 @@ static events: { | ||
emitter: Emitter; | ||
allowReadOnlyEdits: boolean; | ||
protected allowReadOnlyEdits: boolean; | ||
editor: Editor; | ||
@@ -101,4 +121,4 @@ composition: Composition; | ||
uploader: Uploader; | ||
options: ExpandedOptions; | ||
constructor(container: HTMLElement | string, options?: Options); | ||
options: ExpandedQuillOptions; | ||
constructor(container: HTMLElement | string, options?: QuillOptions); | ||
addContainer(container: string, refNode?: Node | null): HTMLDivElement; | ||
@@ -198,3 +218,3 @@ addContainer(container: HTMLElement, refNode?: Node | null): HTMLElement; | ||
} | ||
declare function expandConfig(containerOrSelector: HTMLElement | string, options: Options): ExpandedOptions; | ||
declare function expandConfig(containerOrSelector: HTMLElement | string, options: QuillOptions): ExpandedQuillOptions; | ||
type NormalizedIndexLength = [ | ||
@@ -213,2 +233,3 @@ number, | ||
declare function overload(range: Range, format: Record<string, unknown>, source?: EmitterSource): NormalizedIndexLength; | ||
export type { DebugLevel }; | ||
export { globalRegistry, expandConfig, overload, Quill as default }; |
@@ -17,2 +17,12 @@ import { merge } from 'lodash-es'; | ||
Parchment.ParentBlot.uiClass = 'ql-ui'; | ||
/** | ||
* Options for initializing a Quill instance | ||
*/ | ||
/** | ||
* Similar to QuillOptions, but with all properties expanded to their default values, | ||
* and all selectors resolved to HTMLElements. | ||
*/ | ||
class Quill { | ||
@@ -34,3 +44,3 @@ static DEFAULTS = { | ||
static sources = Emitter.sources; | ||
static version = typeof "2.0.0-rc.3" === 'undefined' ? 'dev' : "2.0.0-rc.3"; | ||
static version = typeof "2.0.0-rc.4" === 'undefined' ? 'dev' : "2.0.0-rc.4"; | ||
static imports = { | ||
@@ -452,2 +462,5 @@ delta: Delta, | ||
} | ||
function omitUndefinedValuesFromOptions(obj) { | ||
return Object.fromEntries(Object.entries(obj).filter(entry => entry[1] !== undefined)); | ||
} | ||
function expandConfig(containerOrSelector, options) { | ||
@@ -480,4 +493,4 @@ const container = resolveSelector(containerOrSelector); | ||
...quillDefaults, | ||
...themeDefaults, | ||
...options | ||
...omitUndefinedValuesFromOptions(themeDefaults), | ||
...omitUndefinedValuesFromOptions(options) | ||
}; | ||
@@ -484,0 +497,0 @@ let registry = options.registry; |
/*! | ||
* Quill Editor v2.0.0-rc.3 | ||
* Quill Editor v2.0.0-rc.4 | ||
* https://quilljs.com | ||
@@ -4,0 +4,0 @@ * Copyright (c) 2017-2024, Slab |
/*! | ||
* Quill Editor v2.0.0-rc.3 | ||
* Quill Editor v2.0.0-rc.4 | ||
* https://quilljs.com | ||
@@ -4,0 +4,0 @@ * Copyright (c) 2017-2024, Slab |
@@ -26,2 +26,3 @@ import type { ScrollBlot } from 'parchment'; | ||
onCaptureCopy(e: ClipboardEvent, isCut?: boolean): void; | ||
private normalizeURIList; | ||
onCapturePaste(e: ClipboardEvent): void; | ||
@@ -28,0 +29,0 @@ onCopy(range: Range, isCut: boolean): { |
@@ -27,2 +27,5 @@ import { Attributor, BlockBlot, ClassAttributor, EmbedBlot, Scope, StyleAttributor } from 'parchment'; | ||
class Clipboard extends Module { | ||
static DEFAULTS = { | ||
matchers: [] | ||
}; | ||
constructor(quill, options) { | ||
@@ -34,4 +37,3 @@ super(quill, options); | ||
this.matchers = []; | ||
// @ts-expect-error Fix me later | ||
CLIPBOARD_CONFIG.concat(this.options.matchers).forEach(_ref => { | ||
CLIPBOARD_CONFIG.concat(this.options.matchers ?? []).forEach(_ref => { | ||
let [selector, matcher] = _ref; | ||
@@ -114,2 +116,11 @@ this.addMatcher(selector, matcher); | ||
} | ||
/* | ||
* https://www.iana.org/assignments/media-types/text/uri-list | ||
*/ | ||
normalizeURIList(urlList) { | ||
return urlList.split(/\r?\n/) | ||
// Ignore all comments | ||
.filter(url => url[0] !== '#').join('\n'); | ||
} | ||
onCapturePaste(e) { | ||
@@ -121,3 +132,9 @@ if (e.defaultPrevented || !this.quill.isEnabled()) return; | ||
const html = e.clipboardData?.getData('text/html'); | ||
const text = e.clipboardData?.getData('text/plain'); | ||
let text = e.clipboardData?.getData('text/plain'); | ||
if (!html && !text) { | ||
const urlList = e.clipboardData?.getData('text/uri-list'); | ||
if (urlList) { | ||
text = this.normalizeURIList(urlList); | ||
} | ||
} | ||
const files = Array.from(e.clipboardData?.files || []); | ||
@@ -195,5 +212,2 @@ if (!html && files.length > 0) { | ||
} | ||
Clipboard.DEFAULTS = { | ||
matchers: [] | ||
}; | ||
function applyFormat(delta, format, value, scroll) { | ||
@@ -204,2 +218,3 @@ if (!scroll.query(format)) { | ||
return delta.reduce((newDelta, op) => { | ||
if (!op.insert) return newDelta; | ||
if (op.attributes && op.attributes[format]) { | ||
@@ -211,3 +226,2 @@ return newDelta.push(op); | ||
} : {}; | ||
// @ts-expect-error Fix me later | ||
return newDelta.insert(op.insert, { | ||
@@ -363,6 +377,6 @@ ...formats, | ||
return delta.reduce((composed, op) => { | ||
if (!op.insert) return composed; | ||
if (op.attributes && typeof op.attributes.indent === 'number') { | ||
return composed.push(op); | ||
} | ||
// @ts-expect-error Fix me later | ||
return composed.insert(op.insert, { | ||
@@ -369,0 +383,0 @@ indent, |
@@ -5,2 +5,7 @@ import { Scope } from 'parchment'; | ||
class History extends Module { | ||
static DEFAULTS = { | ||
delay: 1000, | ||
maxStack: 100, | ||
userOnly: false | ||
}; | ||
lastRecorded = 0; | ||
@@ -127,7 +132,2 @@ ignoreChange = false; | ||
} | ||
History.DEFAULTS = { | ||
delay: 1000, | ||
maxStack: 100, | ||
userOnly: false | ||
}; | ||
function transformStack(stack, delta) { | ||
@@ -134,0 +134,0 @@ let remoteDelta = delta; |
{ | ||
"name": "quill", | ||
"version": "2.0.0-rc.3", | ||
"version": "2.0.0-rc.4", | ||
"description": "Your powerful, rich text editor", | ||
@@ -12,3 +12,3 @@ "author": "Jason Chen <jhchen7@gmail.com>", | ||
"lodash-es": "^4.17.21", | ||
"parchment": "3.0.0-beta.0", | ||
"parchment": "3.0.0-rc.0", | ||
"quill-delta": "^5.1.0" | ||
@@ -46,2 +46,3 @@ }, | ||
"prettier": "^3.0.3", | ||
"source-map-loader": "^5.0.0", | ||
"style-loader": "^3.3.3", | ||
@@ -48,0 +49,0 @@ "stylus": "^0.62.0", |
import Quill from './core.js'; | ||
import type { DebugLevel, ExpandedQuillOptions, QuillOptions } from './core.js'; | ||
export type { DebugLevel, ExpandedQuillOptions, QuillOptions }; | ||
export default Quill; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
3020599
9647
44
287
+ Addedparchment@3.0.0-rc.0(transitive)
- Removedparchment@3.0.0-beta.0(transitive)
Updatedparchment@3.0.0-rc.0