0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2024-12-21 23:03:11 -05:00

Release v2.3.2

This commit is contained in:
Neil Jenkins 2024-08-16 16:02:44 +10:00
parent 671319d316
commit cbd8881e78
10 changed files with 59 additions and 28 deletions

View file

@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file, starting fr
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [2.3.2] - 2024-08-16
### Fixed
- Fix "pathChange" event not being fired on selection change.
- Fix backspace at beginning of quote was deleting the contents, not just
removing the quote.
## [2.3.1] - 2024-07-23 ## [2.3.1] - 2024-07-23
### Fixed ### Fixed

15
dist/squire-raw.js vendored
View file

@ -2594,7 +2594,7 @@
this._lastAnchorNode = anchor; this._lastAnchorNode = anchor;
this._lastFocusNode = focus; this._lastFocusNode = focus;
newPath = anchor && focus ? anchor === focus ? this._getPath(focus) : "(selection)" : ""; newPath = anchor && focus ? anchor === focus ? this._getPath(focus) : "(selection)" : "";
if (this._path !== newPath) { if (this._path !== newPath || anchor !== focus) {
this._path = newPath; this._path = newPath;
this.fireEvent("pathChange", { this.fireEvent("pathChange", {
path: newPath path: newPath
@ -3549,7 +3549,7 @@
this.decreaseListLevel(range); this.decreaseListLevel(range);
return this; return this;
} else if (getNearest(block, root, "BLOCKQUOTE")) { } else if (getNearest(block, root, "BLOCKQUOTE")) {
this.removeQuote(range); this.replaceWithBlankLine(range);
return this; return this;
} }
} }
@ -3900,6 +3900,17 @@
return this.focus(); return this.focus();
} }
removeQuote(range) { removeQuote(range) {
this.modifyBlocks((frag) => {
Array.from(frag.querySelectorAll("blockquote")).forEach(
(el) => {
replaceWith(el, empty(el));
}
);
return frag;
}, range);
return this.focus();
}
replaceWithBlankLine(range) {
this.modifyBlocks( this.modifyBlocks(
() => this.createDefaultBlock([ () => this.createDefaultBlock([
createElement("INPUT", { createElement("INPUT", {

15
dist/squire-raw.mjs vendored
View file

@ -2591,7 +2591,7 @@ var Squire = class {
this._lastAnchorNode = anchor; this._lastAnchorNode = anchor;
this._lastFocusNode = focus; this._lastFocusNode = focus;
newPath = anchor && focus ? anchor === focus ? this._getPath(focus) : "(selection)" : ""; newPath = anchor && focus ? anchor === focus ? this._getPath(focus) : "(selection)" : "";
if (this._path !== newPath) { if (this._path !== newPath || anchor !== focus) {
this._path = newPath; this._path = newPath;
this.fireEvent("pathChange", { this.fireEvent("pathChange", {
path: newPath path: newPath
@ -3546,7 +3546,7 @@ var Squire = class {
this.decreaseListLevel(range); this.decreaseListLevel(range);
return this; return this;
} else if (getNearest(block, root, "BLOCKQUOTE")) { } else if (getNearest(block, root, "BLOCKQUOTE")) {
this.removeQuote(range); this.replaceWithBlankLine(range);
return this; return this;
} }
} }
@ -3897,6 +3897,17 @@ var Squire = class {
return this.focus(); return this.focus();
} }
removeQuote(range) { removeQuote(range) {
this.modifyBlocks((frag) => {
Array.from(frag.querySelectorAll("blockquote")).forEach(
(el) => {
replaceWith(el, empty(el));
}
);
return frag;
}, range);
return this.focus();
}
replaceWithBlankLine(range) {
this.modifyBlocks( this.modifyBlocks(
() => this.createDefaultBlock([ () => this.createDefaultBlock([
createElement("INPUT", { createElement("INPUT", {

18
dist/squire.js vendored

File diff suppressed because one or more lines are too long

4
dist/squire.js.map vendored

File diff suppressed because one or more lines are too long

18
dist/squire.mjs vendored

File diff suppressed because one or more lines are too long

4
dist/squire.mjs.map vendored

File diff suppressed because one or more lines are too long

View file

@ -163,6 +163,7 @@ declare class Squire {
increaseQuoteLevel(range?: Range): Squire; increaseQuoteLevel(range?: Range): Squire;
decreaseQuoteLevel(range?: Range): Squire; decreaseQuoteLevel(range?: Range): Squire;
removeQuote(range?: Range): Squire; removeQuote(range?: Range): Squire;
replaceWithBlankLine(range?: Range): Squire;
code(): Squire; code(): Squire;
removeCode(): Squire; removeCode(): Squire;
toggleCode(): Squire; toggleCode(): Squire;

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,6 @@
{ {
"name": "squire-rte", "name": "squire-rte",
"version": "2.3.1", "version": "2.3.2",
"description": "Squire is an HTML5 rich text editor, which provides powerful cross-browser normalisation, whilst being supremely lightweight and flexible.", "description": "Squire is an HTML5 rich text editor, which provides powerful cross-browser normalisation, whilst being supremely lightweight and flexible.",
"main": "dist/squire.mjs", "main": "dist/squire.mjs",
"types": "dist/types/Squire.d.ts", "types": "dist/types/Squire.d.ts",