0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2024-12-22 15:23:29 -05:00

Release v2.1.1

This commit is contained in:
Neil Jenkins 2023-09-27 14:58:41 +10:00
parent 9f5df9e5c0
commit fc38e8affb
10 changed files with 54 additions and 37 deletions

View file

@ -4,6 +4,13 @@ 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.1.1] - 2023-09-27
### Fixed
- If you changed inline formatting in Chrome and then hit space, the formatting
would be lost. This is now fixed.
## [2.1.0] - 2023-09-19 ## [2.1.0] - 2023-09-19
### Added ### Added

15
dist/squire-raw.js vendored
View file

@ -982,9 +982,12 @@
const startOffset = range.startOffset; const startOffset = range.startOffset;
let nodeAfterCursor; let nodeAfterCursor;
if (startContainer instanceof Text) { if (startContainer instanceof Text) {
if (startOffset) { const text = startContainer.data;
for (let i = startOffset; i > 0; i -= 1) {
if (text.charAt(i - 1) !== ZWS) {
return false; return false;
} }
}
nodeAfterCursor = startContainer; nodeAfterCursor = startContainer;
} else { } else {
nodeAfterCursor = getNodeAfterOffset(startContainer, startOffset); nodeAfterCursor = getNodeAfterOffset(startContainer, startOffset);
@ -1015,10 +1018,13 @@
const endOffset = range.endOffset; const endOffset = range.endOffset;
let currentNode; let currentNode;
if (endContainer instanceof Text) { if (endContainer instanceof Text) {
const length = endContainer.data.length; const text = endContainer.data;
if (length && endOffset < length) { const length = text.length;
for (let i = endOffset; i < length; i += 1) {
if (text.charAt(i) !== ZWS) {
return false; return false;
} }
}
currentNode = endContainer; currentNode = endContainer;
} else { } else {
currentNode = getNodeBeforeOffset(endContainer, endOffset); currentNode = getNodeBeforeOffset(endContainer, endOffset);
@ -1822,7 +1828,6 @@
const root = self._root; const root = self._root;
self._recordUndoState(range); self._recordUndoState(range);
self._getRangeAndRemoveBookmark(range); self._getRangeAndRemoveBookmark(range);
self._removeZWS();
if (!range.collapsed) { if (!range.collapsed) {
deleteContentsOfRange(range, root); deleteContentsOfRange(range, root);
self._ensureBottomLine(); self._ensureBottomLine();
@ -1831,7 +1836,7 @@
} else if (rangeDoesEndAtBlockBoundary(range, root)) { } else if (rangeDoesEndAtBlockBoundary(range, root)) {
const block = getStartBlockOfRange(range, root); const block = getStartBlockOfRange(range, root);
if (block && block.nodeName !== "PRE") { if (block && block.nodeName !== "PRE") {
const text = (_a = block.textContent) == null ? void 0 : _a.trimEnd(); const text = (_a = block.textContent) == null ? void 0 : _a.trimEnd().replace(ZWS, "");
if (text === "*" || text === "1.") { if (text === "*" || text === "1.") {
event.preventDefault(); event.preventDefault();
const walker = new TreeIterator(block, SHOW_TEXT); const walker = new TreeIterator(block, SHOW_TEXT);

15
dist/squire-raw.mjs vendored
View file

@ -980,9 +980,12 @@ var rangeDoesStartAtBlockBoundary = (range, root) => {
const startOffset = range.startOffset; const startOffset = range.startOffset;
let nodeAfterCursor; let nodeAfterCursor;
if (startContainer instanceof Text) { if (startContainer instanceof Text) {
if (startOffset) { const text = startContainer.data;
for (let i = startOffset; i > 0; i -= 1) {
if (text.charAt(i - 1) !== ZWS) {
return false; return false;
} }
}
nodeAfterCursor = startContainer; nodeAfterCursor = startContainer;
} else { } else {
nodeAfterCursor = getNodeAfterOffset(startContainer, startOffset); nodeAfterCursor = getNodeAfterOffset(startContainer, startOffset);
@ -1013,10 +1016,13 @@ var rangeDoesEndAtBlockBoundary = (range, root) => {
const endOffset = range.endOffset; const endOffset = range.endOffset;
let currentNode; let currentNode;
if (endContainer instanceof Text) { if (endContainer instanceof Text) {
const length = endContainer.data.length; const text = endContainer.data;
if (length && endOffset < length) { const length = text.length;
for (let i = endOffset; i < length; i += 1) {
if (text.charAt(i) !== ZWS) {
return false; return false;
} }
}
currentNode = endContainer; currentNode = endContainer;
} else { } else {
currentNode = getNodeBeforeOffset(endContainer, endOffset); currentNode = getNodeBeforeOffset(endContainer, endOffset);
@ -1819,7 +1825,6 @@ var Space = (self, event, range) => {
const root = self._root; const root = self._root;
self._recordUndoState(range); self._recordUndoState(range);
self._getRangeAndRemoveBookmark(range); self._getRangeAndRemoveBookmark(range);
self._removeZWS();
if (!range.collapsed) { if (!range.collapsed) {
deleteContentsOfRange(range, root); deleteContentsOfRange(range, root);
self._ensureBottomLine(); self._ensureBottomLine();
@ -1828,7 +1833,7 @@ var Space = (self, event, range) => {
} else if (rangeDoesEndAtBlockBoundary(range, root)) { } else if (rangeDoesEndAtBlockBoundary(range, root)) {
const block = getStartBlockOfRange(range, root); const block = getStartBlockOfRange(range, root);
if (block && block.nodeName !== "PRE") { if (block && block.nodeName !== "PRE") {
const text = block.textContent?.trimEnd(); const text = block.textContent?.trimEnd().replace(ZWS, "");
if (text === "*" || text === "1.") { if (text === "*" || text === "1.") {
event.preventDefault(); event.preventDefault();
const walker = new TreeIterator(block, SHOW_TEXT); const walker = new TreeIterator(block, SHOW_TEXT);

14
dist/squire.js vendored

File diff suppressed because one or more lines are too long

6
dist/squire.js.map vendored

File diff suppressed because one or more lines are too long

14
dist/squire.mjs vendored

File diff suppressed because one or more lines are too long

6
dist/squire.mjs.map vendored

File diff suppressed because one or more lines are too long

View file

@ -1 +1 @@
{"version":3,"file":"Space.d.ts","sourceRoot":"","sources":["../../../source/keyboard/Space.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAWxC,QAAA,MAAM,KAAK,SAAU,MAAM,SAAS,aAAa,SAAS,KAAK,KAAG,IA+DjE,CAAC;AAIF,OAAO,EAAE,KAAK,EAAE,CAAC"} {"version":3,"file":"Space.d.ts","sourceRoot":"","sources":["../../../source/keyboard/Space.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAWxC,QAAA,MAAM,KAAK,SAAU,MAAM,SAAS,aAAa,SAAS,KAAK,KAAG,IA8DjE,CAAC;AAIF,OAAO,EAAE,KAAK,EAAE,CAAC"}

View file

@ -1 +1 @@
{"version":3,"file":"Block.d.ts","sourceRoot":"","sources":["../../../source/range/Block.ts"],"names":[],"mappings":"AAWA,QAAA,MAAM,oBAAoB,UACf,KAAK,QACN,OAAO,GAAG,gBAAgB,KACjC,WAAW,GAAG,IAmBhB,CAAC;AAIF,QAAA,MAAM,kBAAkB,UACb,KAAK,QACN,OAAO,GAAG,gBAAgB,KACjC,WAAW,GAAG,IA0BhB,CAAC;AAQF,QAAA,MAAM,6BAA6B,UACxB,KAAK,QACN,OAAO,KACd,OAsCF,CAAC;AAEF,QAAA,MAAM,2BAA2B,UAAW,KAAK,QAAQ,OAAO,KAAG,OA6BlE,CAAC;AAEF,QAAA,MAAM,4BAA4B,UAAW,KAAK,QAAQ,OAAO,KAAG,IAWnE,CAAC;AAIF,OAAO,EACH,oBAAoB,EACpB,kBAAkB,EAClB,6BAA6B,EAC7B,2BAA2B,EAC3B,4BAA4B,GAC/B,CAAC"} {"version":3,"file":"Block.d.ts","sourceRoot":"","sources":["../../../source/range/Block.ts"],"names":[],"mappings":"AAWA,QAAA,MAAM,oBAAoB,UACf,KAAK,QACN,OAAO,GAAG,gBAAgB,KACjC,WAAW,GAAG,IAmBhB,CAAC;AAIF,QAAA,MAAM,kBAAkB,UACb,KAAK,QACN,OAAO,GAAG,gBAAgB,KACjC,WAAW,GAAG,IA0BhB,CAAC;AAQF,QAAA,MAAM,6BAA6B,UACxB,KAAK,QACN,OAAO,KACd,OAyCF,CAAC;AAEF,QAAA,MAAM,2BAA2B,UAAW,KAAK,QAAQ,OAAO,KAAG,OAgClE,CAAC;AAEF,QAAA,MAAM,4BAA4B,UAAW,KAAK,QAAQ,OAAO,KAAG,IAWnE,CAAC;AAIF,OAAO,EACH,oBAAoB,EACpB,kBAAkB,EAClB,6BAA6B,EAC7B,2BAA2B,EAC3B,4BAA4B,GAC/B,CAAC"}

View file

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