0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2024-12-22 07:13:08 -05:00

Release v2.3.0

This commit is contained in:
Neil Jenkins 2024-07-18 13:08:36 +10:00
parent 4d0836c670
commit af26ba85d2
11 changed files with 38 additions and 20 deletions

View file

@ -4,6 +4,18 @@ 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.0] - 2024-07-18
### Fixed
- Fix text nodes sometimes incorrectly merged after delete.
### Added
- HTML copied from the editor now includes a `<!-- squire -->` comment
- The willPaste event now includes an `html` property in the details, with the
raw HTML that is being pasted.
## [2.2.9] - 2024-07-17 ## [2.2.9] - 2024-07-17
### Fixed ### Fixed

11
dist/squire-raw.js vendored
View file

@ -1129,11 +1129,12 @@
frag.appendChild(node); frag.appendChild(node);
node = next; node = next;
} }
if (startContainer instanceof Text && endContainer instanceof Text) { node = endContainer.previousSibling;
startContainer.appendData(endContainer.data); if (node && node instanceof Text && endContainer instanceof Text) {
endOffset = node.length;
node.appendData(endContainer.data);
detach(endContainer); detach(endContainer);
endContainer = startContainer; endContainer = node;
endOffset = startOffset;
} }
range.setStart(startContainer, startOffset); range.setStart(startContainer, startOffset);
if (endContainer) { if (endContainer) {
@ -1415,6 +1416,7 @@
text = text.replace(/\r?\n/g, "\r\n"); text = text.replace(/\r?\n/g, "\r\n");
} }
if (!plainTextOnly && html && text !== html) { if (!plainTextOnly && html && text !== html) {
html = "<!-- squire -->" + html;
clipboardData.setData("text/html", html); clipboardData.setData("text/html", html);
} }
clipboardData.setData("text/plain", text); clipboardData.setData("text/plain", text);
@ -2869,6 +2871,7 @@
const event = new CustomEvent("willPaste", { const event = new CustomEvent("willPaste", {
cancelable: true, cancelable: true,
detail: { detail: {
html,
fragment: frag fragment: frag
} }
}); });

11
dist/squire-raw.mjs vendored
View file

@ -1127,11 +1127,12 @@ var extractContentsOfRange = (range, common, root) => {
frag.appendChild(node); frag.appendChild(node);
node = next; node = next;
} }
if (startContainer instanceof Text && endContainer instanceof Text) { node = endContainer.previousSibling;
startContainer.appendData(endContainer.data); if (node && node instanceof Text && endContainer instanceof Text) {
endOffset = node.length;
node.appendData(endContainer.data);
detach(endContainer); detach(endContainer);
endContainer = startContainer; endContainer = node;
endOffset = startOffset;
} }
range.setStart(startContainer, startOffset); range.setStart(startContainer, startOffset);
if (endContainer) { if (endContainer) {
@ -1413,6 +1414,7 @@ var extractRangeToClipboard = (event, range, root, removeRangeFromDocument, toCl
text = text.replace(/\r?\n/g, "\r\n"); text = text.replace(/\r?\n/g, "\r\n");
} }
if (!plainTextOnly && html && text !== html) { if (!plainTextOnly && html && text !== html) {
html = "<!-- squire -->" + html;
clipboardData.setData("text/html", html); clipboardData.setData("text/html", html);
} }
clipboardData.setData("text/plain", text); clipboardData.setData("text/plain", text);
@ -2866,6 +2868,7 @@ var Squire = class {
const event = new CustomEvent("willPaste", { const event = new CustomEvent("willPaste", {
cancelable: true, cancelable: true,
detail: { detail: {
html,
fragment: frag fragment: frag
} }
}); });

4
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

4
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

@ -1 +1 @@
{"version":3,"file":"Clipboard.d.ts","sourceRoot":"","sources":["../../source/Clipboard.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAOvC,QAAA,MAAM,uBAAuB,UAClB,cAAc,SACd,KAAK,QACN,WAAW,2BACQ,OAAO,eACnB,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC,eACjC,IAAI,GAAG,CAAC,CAAC,IAA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F,OAAO,EACH,uBAAuB,EACvB,MAAM,EACN,OAAO,EACP,gBAAgB,EAChB,QAAQ,EACR,OAAO,GACV,CAAC"}

File diff suppressed because one or more lines are too long

View file

@ -1 +1 @@
{"version":3,"file":"InsertDelete.d.ts","sourceRoot":"","sources":["../../../source/range/InsertDelete.ts"],"names":[],"mappings":"AAyBA,iBAAS,WAAW,CAAC,cAAc,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,GAAG,KAAK,CAAC;AACvE,iBAAS,WAAW,CAChB,cAAc,EAAE,IAAI,EACpB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,IAAI,EAClB,SAAS,EAAE,MAAM,GAClB,KAAK,CAAC;AAiBT,QAAA,MAAM,iBAAiB,UAAW,KAAK,QAAQ,IAAI,KAAG,IAiDrD,CAAC;AAEF;;;;;GAKG;AACH,QAAA,MAAM,sBAAsB,UACjB,KAAK,UACJ,IAAI,GAAG,IAAI,QACb,OAAO,KACd,gBA6CF,CAAC;AAuBF,QAAA,MAAM,qBAAqB,UAChB,KAAK,QACN,OAAO,KACd,gBA8GF,CAAC;AAIF,QAAA,MAAM,2BAA2B,UACtB,KAAK,QACN,gBAAgB,QAChB,OAAO,KACd,IAsIF,CAAC;AAIF,OAAO,EACH,WAAW,EACX,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EACjB,2BAA2B,GAC9B,CAAC"} {"version":3,"file":"InsertDelete.d.ts","sourceRoot":"","sources":["../../../source/range/InsertDelete.ts"],"names":[],"mappings":"AAyBA,iBAAS,WAAW,CAAC,cAAc,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,GAAG,KAAK,CAAC;AACvE,iBAAS,WAAW,CAChB,cAAc,EAAE,IAAI,EACpB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,IAAI,EAClB,SAAS,EAAE,MAAM,GAClB,KAAK,CAAC;AAiBT,QAAA,MAAM,iBAAiB,UAAW,KAAK,QAAQ,IAAI,KAAG,IAiDrD,CAAC;AAEF;;;;;GAKG;AACH,QAAA,MAAM,sBAAsB,UACjB,KAAK,UACJ,IAAI,GAAG,IAAI,QACb,OAAO,KACd,gBA8CF,CAAC;AAuBF,QAAA,MAAM,qBAAqB,UAChB,KAAK,QACN,OAAO,KACd,gBA8GF,CAAC;AAIF,QAAA,MAAM,2BAA2B,UACtB,KAAK,QACN,gBAAgB,QAChB,OAAO,KACd,IAsIF,CAAC;AAIF,OAAO,EACH,WAAW,EACX,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EACjB,2BAA2B,GAC9B,CAAC"}

View file

@ -1,6 +1,6 @@
{ {
"name": "squire-rte", "name": "squire-rte",
"version": "2.2.9", "version": "2.3.0",
"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",