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

quill

Package Overview
Dependencies
Maintainers
1
Versions
94
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 1.2.2 to 1.2.3

1

blots/scroll.js

@@ -18,2 +18,3 @@ import Parchment from 'parchment';

this.emitter = config.emitter;
this.scrollingContainer = config.scrollingContainer;
if (Array.isArray(config.whitelist)) {

@@ -20,0 +21,0 @@ this.whitelist = config.whitelist.reduce(function(whitelist, format) {

@@ -0,1 +1,10 @@

# 1.2.3
- Fix scrolling when appending new lines [#1276](https://github.com/quilljs/quill/issues/1276) [#1361](https://github.com/quilljs/quill/issues/1361)
- Fix binding to explicit shortcut key [#1365](https://github.com/quilljs/quill/issues/1365)
- Merge clone update [#1359](https://github.com/quilljs/quill/pull/1359)
Thank you [@artaommahe](https://github.com/artaommahe), [@c-w](https://github.com/c-w), [@EladBet](https://github.com/EladBet), [@emenoh](https://github.com/emenoh), and [@montlebalm](https://github.com/montlebalm) for contributions to this release!
# 1.2.2

@@ -2,0 +11,0 @@

@@ -53,2 +53,4 @@ import './polyfill';

Parchment.register(target);
} else if (path.startsWith('modules') && typeof target.register === 'function') {
target.register();
}

@@ -61,3 +63,2 @@ }

this.container = this.options.container;
this.scrollingContainer = this.options.scrollingContainer || document.body;
if (this.container == null) {

@@ -75,5 +76,7 @@ return debug.error('Invalid Quill container', container);

this.root.classList.add('ql-blank');
this.scrollingContainer = this.options.scrollingContainer || this.root;
this.emitter = new Emitter();
this.scroll = Parchment.create(this.root, {
emitter: this.emitter,
scrollingContainer: this.scrollingContainer,
whitelist: this.options.formats

@@ -184,7 +187,17 @@ });

getBounds(index, length = 0) {
let bounds;
if (typeof index === 'number') {
return this.selection.getBounds(index, length);
bounds = this.selection.getBounds(index, length);
} else {
return this.selection.getBounds(index.index, index.length);
bounds = this.selection.getBounds(index.index, index.length);
}
let containerBounds = this.container.getBoundingClientRect();
return {
bottom: bounds.bottom - containerBounds.top,
height: bounds.height,
left: bounds.left - containerBounds.left,
right: bounds.right - containerBounds.left,
top: bounds.top - containerBounds.top,
width: bounds.width
};
}

@@ -191,0 +204,0 @@

40

core/selection.js

@@ -92,3 +92,3 @@ import Parchment from 'parchment';

length = Math.min(index + length, scrollLength - 1) - index;
let bounds, node, [leaf, offset] = this.scroll.leaf(index);
let node, [leaf, offset] = this.scroll.leaf(index);
if (leaf == null) return null;

@@ -103,3 +103,3 @@ [node, offset] = leaf.position(offset, true);

range.setEnd(node, offset);
bounds = range.getBoundingClientRect();
return range.getBoundingClientRect();
} else {

@@ -122,18 +122,11 @@ let side = 'left';

}
bounds = {
return {
bottom: rect.top + rect.height,
height: rect.height,
left: rect[side],
width: 0,
top: rect.top
right: rect[side],
top: rect.top,
width: 0
};
}
let containerBounds = this.root.parentNode.getBoundingClientRect();
return {
left: bounds.left - containerBounds.left,
right: bounds.left + bounds.width - containerBounds.left,
top: bounds.top - containerBounds.top,
bottom: bounds.top + bounds.height - containerBounds.top,
height: bounds.height,
width: bounds.width
};
}

@@ -206,9 +199,16 @@

if (bounds == null) return;
if (this.root.offsetHeight < bounds.bottom) {
let [line, ] = this.scroll.line(Math.min(range.index + range.length, this.scroll.length()-1));
this.root.scrollTop = line.domNode.offsetTop + line.domNode.offsetHeight - this.root.offsetHeight;
} else if (bounds.top < 0) {
let [line, ] = this.scroll.line(Math.min(range.index, this.scroll.length()-1));
this.root.scrollTop = line.domNode.offsetTop;
let limit = this.scroll.length()-1;
let [first, ] = this.scroll.line(Math.min(range.index, limit));
let last = first;
if (range.length > 0) {
[last, ] = this.scroll.line(Math.min(range.index + range.length, limit));
}
if (first == null || last == null) return;
let scroller = this.scroll.scrollingContainer;
let scrollBounds = scroller.getBoundingClientRect();
if (bounds.top < scrollBounds.top) {
scroller.scrollTop -= (scrollBounds.top - bounds.top);
} else if (bounds.bottom > scrollBounds.bottom) {
scroller.scrollTop += (bounds.bottom - scrollBounds.bottom);
}
}

@@ -215,0 +215,0 @@

import Embed from '../blots/embed';
import Quill from '../core/quill';
import Module from '../core/module';

@@ -29,7 +30,13 @@

function Formula() {
if (window.katex == null) {
throw new Error('Formula module requires KaTeX.');
class Formula extends Module {
static register() {
Quill.register(FormulaBlot, true);
}
Quill.register(FormulaBlot, true);
constructor() {
super();
if (window.katex == null) {
throw new Error('Formula module requires KaTeX.');
}
}
}

@@ -36,0 +43,0 @@

@@ -18,5 +18,4 @@ import clone from 'clone';

binding = normalize(binding);
if (!!binding.shortKey !== evt[SHORTKEY] && binding.shortKey !== null) return false;
if (['altKey', 'ctrlKey', 'metaKey', 'shiftKey'].some(function(key) {
return (key != SHORTKEY && !!binding[key] !== evt[key] && binding[key] !== null);
return (!!binding[key] !== evt[key] && binding[key] !== null);
})) {

@@ -238,7 +237,20 @@ return false;

format: { list: false },
prefix: /^\s*?(1\.|-)$/,
prefix: /^\s*?(1\.|-|\[ \]|\[x\])$/,
handler: function(range, context) {
if (this.quill.scroll.whitelist != null && !this.quill.scroll.whitelist['list']) return true;
let length = context.prefix.length;
let value = context.prefix.trim().length === 1 ? 'bullet' : 'ordered'
let value;
switch (context.prefix.trim()) {
case '[ ]':
value = 'unchecked';
break;
case '[x]':
value = 'checked';
break;
case '-':
value = 'bullet';
break;
default:
value = 'ordered';
}
this.quill.scroll.deleteAt(range.index - length, length);

@@ -385,2 +397,6 @@ this.quill.formatLine(range.index - length, 1, 'list', value, Quill.sources.USER);

}
if (binding.shortKey) {
binding[SHORTKEY] = binding.shortKey;
delete binding.shortKey;
}
return binding;

@@ -390,2 +406,2 @@ }

export default Keyboard;
export { Keyboard as default, SHORTKEY };

@@ -34,2 +34,7 @@ import Parchment from 'parchment';

class Syntax extends Module {
static register() {
Quill.register(CodeToken, true);
Quill.register(SyntaxCodeBlock, true);
}
constructor(quill, options) {

@@ -40,4 +45,2 @@ super(quill, options);

}
Quill.register(CodeToken, true);
Quill.register(SyntaxCodeBlock, true);
let timer = null;

@@ -44,0 +47,0 @@ this.quill.on(Quill.events.SCROLL_OPTIMIZE, () => {

{
"name": "quill",
"version": "1.2.2",
"version": "1.2.3",
"description": "Your powerful, rich text editor",

@@ -35,3 +35,3 @@ "author": "Jason Chen <jhchen7@gmail.com>",

"dependencies": {
"clone": "~2.1.0",
"clone": "~2.1.1",
"deep-equal": "~1.0.1",

@@ -41,18 +41,18 @@ "eventemitter3": "~2.0.2",

"parchment": "1.0.8",
"quill-delta": "3.4.3"
"quill-delta": "3.5.0"
},
"devDependencies": {
"babel-core": "^6.22.1",
"babel-loader": "^6.2.10",
"babel-plugin-istanbul": "^4.0.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.22.0",
"babel-preset-es2015": "^6.22.0",
"css-loader": "~0.26.1",
"eslint": "^3.15.0",
"eslint-loader": "^1.6.1",
"extract-text-webpack-plugin": "^2.0.0-rc.3",
"html-loader": "~0.4.4",
"babel-core": "^6.24.0",
"babel-loader": "^6.4.1",
"babel-plugin-istanbul": "^4.1.1",
"babel-plugin-transform-es2015-modules-commonjs": "^6.24.0",
"babel-preset-es2015": "^6.24.0",
"css-loader": "~0.27.3",
"eslint": "^3.18.0",
"eslint-loader": "^1.7.0",
"extract-text-webpack-plugin": "^2.1.0",
"html-loader": "~0.4.5",
"http-proxy": "^1.16.2",
"jasmine-core": "^2.5.2",
"karma": "^1.4.1",
"karma": "^1.5.0",
"karma-chrome-launcher": "^2.0.0",

@@ -63,13 +63,13 @@ "karma-coverage": "^1.1.1",

"lodash": "^4.17.4",
"style-loader": "~0.13.1",
"style-loader": "~0.16.1",
"stylus": "~0.54.5",
"stylus-loader": "^2.4.0",
"ts-loader": "^2.0.0",
"typescript": "^2.1.6",
"wdio-jasmine-framework": "~0.2.19",
"wdio-spec-reporter": "~0.0.5",
"webdriver-manager": "^12.0.2",
"stylus-loader": "^3.0.1",
"ts-loader": "^2.0.3",
"typescript": "^2.2.2",
"wdio-jasmine-framework": "~0.3.0",
"wdio-spec-reporter": "~0.1.0",
"webdriver-manager": "^12.0.4",
"webdriverio": "^4.6.2",
"webpack": "^2.2.1",
"webpack-dev-server": "^2.3.0"
"webpack": "^2.3.2",
"webpack-dev-server": "^2.4.2"
},

@@ -76,0 +76,0 @@ "license": "BSD-3-Clause",

@@ -195,5 +195,5 @@ import extend from 'extend';

restoreFocus() {
let scrollTop = this.quill.root.scrollTop;
let scrollTop = this.quill.scrollingContainer.scrollTop;
this.quill.focus();
this.quill.root.scrollTop = scrollTop;
this.quill.scrollingContainer.scrollTop = scrollTop;
}

@@ -200,0 +200,0 @@

@@ -7,5 +7,7 @@ class Tooltip {

this.root.innerHTML = this.constructor.TEMPLATE;
this.quill.root.addEventListener('scroll', () => {
this.root.style.marginTop = (-1*this.quill.root.scrollTop) + 'px';
});
if (this.quill.root === this.quill.scrollingContainer) {
this.quill.root.addEventListener('scroll', () => {
this.root.style.marginTop = (-1*this.quill.root.scrollTop) + 'px';
});
}
this.hide();

@@ -20,2 +22,3 @@ }

let left = reference.left + reference.width/2 - this.root.offsetWidth/2;
// root.scrollTop should be 0 if scrollContainer !== root
let top = reference.bottom + this.quill.root.scrollTop;

@@ -38,4 +41,4 @@ this.root.style.left = left + 'px';

let height = rootBounds.bottom - rootBounds.top;
let verticalShift = containerBounds.bottom - rootBounds.bottom - height;
this.root.style.top = (top + verticalShift) + 'px';
let verticalShift = reference.bottom - reference.top + height;
this.root.style.top = (top - verticalShift) + 'px';
this.root.classList.add('ql-flip');

@@ -42,0 +45,0 @@ }

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 too big to display

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

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