Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

quill

Package Overview
Dependencies
Maintainers
2
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

quill - npm Package Compare versions

Comparing version 0.0.0-experimental-5b72e1af6-20240316 to 0.0.0-experimental-6acd59e4d-20240404

6

core.d.ts

@@ -1,4 +0,6 @@

import Quill from './core/quill.js';
import Quill, { Parchment, Range } from './core/quill.js';
import type { Bounds, DebugLevel, EmitterSource, ExpandedQuillOptions, QuillOptions } from './core/quill.js';
import Delta, { Op, OpIterator, AttributeMap } from 'quill-delta';
export { Delta, Op, OpIterator, AttributeMap };
export { Delta, Op, OpIterator, AttributeMap, Parchment, Range };
export type { Bounds, DebugLevel, EmitterSource, ExpandedQuillOptions, QuillOptions, };
export default Quill;

@@ -1,2 +0,2 @@

import Quill from './core/quill.js';
import Quill, { Parchment, Range } from './core/quill.js';
import Block, { BlockEmbed } from './blots/block.js';

@@ -17,3 +17,3 @@ import Break from './blots/break.js';

import UINode from './modules/uiNode.js';
export { Delta, Op, OpIterator, AttributeMap };
export { Delta, Op, OpIterator, AttributeMap, Parchment, Range };
Quill.register({

@@ -20,0 +20,0 @@ 'blots/block': Block,

@@ -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;

@@ -118,7 +138,5 @@ addContainer(container: HTMLElement, refNode?: Node | null): HTMLElement;

formatLine(index: number, length: number, name: string, value?: unknown, source?: EmitterSource): Delta;
formatText(range: {
index: number;
length: number;
}, name: string, value: unknown, source?: EmitterSource): Delta;
formatText(index: number, length: number, name: string, value: unknown, source: EmitterSource): Delta;
formatText(range: Range, name: string, value: unknown, source?: EmitterSource): Delta;
formatText(index: number, length: number, name: string, value: unknown, source?: EmitterSource): Delta;
formatText(index: number, length: number, formats: Record<string, unknown>, source?: EmitterSource): Delta;
getBounds(index: number | Range, length?: number): Bounds | null;

@@ -129,6 +147,3 @@ getContents(index?: number, length?: number): Delta;

};
getFormat(range?: {
index: number;
length: number;
}): {
getFormat(range?: Range): {
[format: string]: unknown;

@@ -140,6 +155,3 @@ };

getLine(index: number): [Block | BlockEmbed | null, number];
getLines(range: {
index: number;
length: number;
}): (Block | BlockEmbed)[];
getLines(range: Range): (Block | BlockEmbed)[];
getLines(index?: number, length?: number): (Block | BlockEmbed)[];

@@ -149,17 +161,11 @@ getModule(name: string): unknown;

getSelection(focus?: boolean): Range | null;
getSemanticHTML(range: {
index: number;
length: number;
}): string;
getSemanticHTML(range: Range): string;
getSemanticHTML(index?: number, length?: number): string;
getText(range?: {
index: number;
length: number;
}): string;
getText(range?: Range): string;
getText(index?: number, length?: number): string;
hasFocus(): boolean;
insertEmbed(index: number, embed: string, value: unknown, source?: EmitterSource): any;
insertText(index: number, text: string, source: EmitterSource): Delta;
insertText(index: number, text: string, formats: Record<string, unknown>, source: EmitterSource): Delta;
insertText(index: number, text: string, name: string, value: unknown, source: EmitterSource): Delta;
insertText(index: number, text: string, source?: EmitterSource): Delta;
insertText(index: number, text: string, formats: Record<string, unknown>, source?: EmitterSource): Delta;
insertText(index: number, text: string, name: string, value: unknown, source?: EmitterSource): Delta;
isEnabled(): boolean;

@@ -182,3 +188,3 @@ off(...args: Parameters<(typeof Emitter)['prototype']['off']>): Emitter;

once(...args: Parameters<(typeof Emitter)['prototype']['once']>): Emitter;
removeFormat(...args: Parameters<typeof overload>): any;
removeFormat(index: number, length: number, source?: EmitterSource): any;
scrollRectIntoView(rect: Rect): void;

@@ -203,3 +209,3 @@ /**

}
declare function expandConfig(containerOrSelector: HTMLElement | string, options: Options): ExpandedOptions;
declare function expandConfig(containerOrSelector: HTMLElement | string, options: QuillOptions): ExpandedQuillOptions;
type NormalizedIndexLength = [

@@ -218,2 +224,4 @@ number,

declare function overload(range: Range, format: Record<string, unknown>, source?: EmitterSource): NormalizedIndexLength;
export type { Bounds, DebugLevel, EmitterSource };
export { Parchment, Range };
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 "0.0.0-experimental-5b72e1af6-20240316" === 'undefined' ? 'dev' : "0.0.0-experimental-5b72e1af6-20240316";
static version = typeof "0.0.0-experimental-6acd59e4d-20240404" === 'undefined' ? 'dev' : "0.0.0-experimental-6acd59e4d-20240404";
static imports = {

@@ -365,4 +375,4 @@ delta: Delta,

}
removeFormat() {
const [index, length,, source] = overload(...arguments);
removeFormat(index, length, source) {
[index, length,, source] = overload(index, length, source);
return modify.call(this, () => {

@@ -453,2 +463,5 @@ return this.editor.removeFormat(index, length);

}
function omitUndefinedValuesFromOptions(obj) {
return Object.fromEntries(Object.entries(obj).filter(entry => entry[1] !== undefined));
}
function expandConfig(containerOrSelector, options) {

@@ -481,4 +494,4 @@ const container = resolveSelector(containerOrSelector);

...quillDefaults,
...themeDefaults,
...options
...omitUndefinedValuesFromOptions(themeDefaults),
...omitUndefinedValuesFromOptions(options)
};

@@ -615,3 +628,4 @@ let registry = options.registry;

}
export { Parchment, Range };
export { globalRegistry, expandConfig, overload, Quill as default };
//# sourceMappingURL=quill.js.map

@@ -25,3 +25,3 @@ import Emitter from './emitter.js';

}
declare class Range {
export declare class Range {
index: number;

@@ -75,2 +75,2 @@ length: number;

}
export { Range, Selection as default };
export default Selection;

@@ -6,3 +6,3 @@ import { LeafBlot, Scope } from 'parchment';

const debug = logger('quill:selection');
class Range {
export class Range {
constructor(index) {

@@ -375,3 +375,3 @@ let length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;

}
export { Range, Selection as default };
export default Selection;
//# sourceMappingURL=selection.js.map
/*!
* Quill Editor v0.0.0-experimental-5b72e1af6-20240316
* Quill Editor v0.0.0-experimental-6acd59e4d-20240404
* https://quilljs.com

@@ -4,0 +4,0 @@ * Copyright (c) 2017-2024, Slab

/*!
* Quill Editor v0.0.0-experimental-5b72e1af6-20240316
* Quill Editor v0.0.0-experimental-6acd59e4d-20240404
* 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, {

@@ -375,4 +389,8 @@ indent,

function matchList(node, delta, scroll) {
// @ts-expect-error
const list = node.tagName === 'OL' ? 'ordered' : 'bullet';
const element = node;
let list = element.tagName === 'OL' ? 'ordered' : 'bullet';
const checkedAttr = element.getAttribute('data-checked');
if (checkedAttr) {
list = checkedAttr === 'true' ? 'checked' : 'unchecked';
}
return applyFormat(delta, 'list', list, scroll);

@@ -379,0 +397,0 @@ }

@@ -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": "0.0.0-experimental-5b72e1af6-20240316",
"version": "0.0.0-experimental-6acd59e4d-20240404",
"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"

@@ -15,0 +15,0 @@ },

@@ -1,2 +0,5 @@

import Quill from './core.js';
import Quill, { Parchment, Range } from './core.js';
import type { Bounds, DebugLevel, EmitterSource, ExpandedQuillOptions, QuillOptions } from './core.js';
export type { Bounds, DebugLevel, EmitterSource, ExpandedQuillOptions, QuillOptions, };
export { Parchment, Range };
export default Quill;

@@ -1,2 +0,2 @@

import Quill from './core.js';
import Quill, { Parchment, Range } from './core.js';
import { AlignClass, AlignStyle } from './formats/align.js';

@@ -80,3 +80,4 @@ import { DirectionAttribute, DirectionClass, DirectionStyle } from './formats/direction.js';

}, true);
export { Parchment, Range };
export default Quill;
//# sourceMappingURL=quill.js.map

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc