mirror of
https://github.com/fastmail/Squire.git
synced 2024-12-22 07:13:08 -05:00
Release v2.0.1
This commit is contained in:
parent
1904405ab8
commit
27f19c4782
8 changed files with 113 additions and 49 deletions
14
CHANGELOG.md
14
CHANGELOG.md
|
@ -4,6 +4,20 @@ 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).
|
||||
|
||||
## [2.0.1] - 2023-02-14
|
||||
|
||||
### Changed
|
||||
|
||||
- Auto delink if backspacing inside auto-linked URL. This means if you make a
|
||||
mistake and backspace, you don't end up accidentally fixing the text but
|
||||
leaving the link to the wrong URL.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix duplicate CSS created when replacing styles
|
||||
- Support browsers without Selection#setBaseAndExtent API. This includes some
|
||||
older Firefox versions.
|
||||
|
||||
## [2.0.0] - 2023-01-23
|
||||
|
||||
### Added
|
||||
|
|
49
dist/squire-raw.js
vendored
49
dist/squire-raw.js
vendored
|
@ -338,6 +338,12 @@
|
|||
if (!child || isLeaf(child)) {
|
||||
if (startOffset) {
|
||||
child = startContainer.childNodes[startOffset - 1];
|
||||
let prev = child.previousSibling;
|
||||
while (child instanceof Text && !child.length && prev && prev instanceof Text) {
|
||||
child.remove();
|
||||
child = prev;
|
||||
continue;
|
||||
}
|
||||
if (child instanceof Text) {
|
||||
startContainer = child;
|
||||
startOffset = child.data.length;
|
||||
|
@ -695,12 +701,16 @@
|
|||
newTreeBottom.appendChild(el);
|
||||
}
|
||||
newTreeBottom = el;
|
||||
node.style.setProperty(attr, css);
|
||||
node.style.removeProperty(attr);
|
||||
}
|
||||
}
|
||||
if (newTreeTop && newTreeBottom) {
|
||||
newTreeBottom.appendChild(empty(node));
|
||||
node.appendChild(newTreeTop);
|
||||
if (node.style.cssText) {
|
||||
node.appendChild(newTreeTop);
|
||||
} else {
|
||||
replaceWith(node, newTreeTop);
|
||||
}
|
||||
}
|
||||
return newTreeBottom || node;
|
||||
};
|
||||
|
@ -1703,10 +1713,20 @@
|
|||
self._updatePath(range, true);
|
||||
}
|
||||
} else {
|
||||
self.setSelection(range);
|
||||
setTimeout(() => {
|
||||
afterDelete(self);
|
||||
}, 0);
|
||||
moveRangeBoundariesDownTree(range);
|
||||
const text = range.startContainer;
|
||||
const offset = range.startOffset;
|
||||
const a = text.parentNode;
|
||||
if (text instanceof Text && a instanceof HTMLAnchorElement && offset && a.href.includes(text.data)) {
|
||||
text.deleteData(offset - 1, 1);
|
||||
self.setSelection(range);
|
||||
self.removeLink();
|
||||
} else {
|
||||
self.setSelection(range);
|
||||
setTimeout(() => {
|
||||
afterDelete(self);
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -2473,12 +2493,17 @@
|
|||
} else {
|
||||
const selection = window.getSelection();
|
||||
if (selection) {
|
||||
selection.setBaseAndExtent(
|
||||
range.startContainer,
|
||||
range.startOffset,
|
||||
range.endContainer,
|
||||
range.endOffset
|
||||
);
|
||||
if ("setBaseAndExtent" in Selection.prototype) {
|
||||
selection.setBaseAndExtent(
|
||||
range.startContainer,
|
||||
range.startOffset,
|
||||
range.endContainer,
|
||||
range.endOffset
|
||||
);
|
||||
} else {
|
||||
selection.removeAllRanges();
|
||||
selection.addRange(range);
|
||||
}
|
||||
}
|
||||
}
|
||||
return this;
|
||||
|
|
49
dist/squire-raw.mjs
vendored
49
dist/squire-raw.mjs
vendored
|
@ -340,6 +340,12 @@ var moveRangeBoundariesDownTree = (range) => {
|
|||
if (!child || isLeaf(child)) {
|
||||
if (startOffset) {
|
||||
child = startContainer.childNodes[startOffset - 1];
|
||||
let prev = child.previousSibling;
|
||||
while (child instanceof Text && !child.length && prev && prev instanceof Text) {
|
||||
child.remove();
|
||||
child = prev;
|
||||
continue;
|
||||
}
|
||||
if (child instanceof Text) {
|
||||
startContainer = child;
|
||||
startOffset = child.data.length;
|
||||
|
@ -697,12 +703,16 @@ var replaceStyles = (node, _, config) => {
|
|||
newTreeBottom.appendChild(el);
|
||||
}
|
||||
newTreeBottom = el;
|
||||
node.style.setProperty(attr, css);
|
||||
node.style.removeProperty(attr);
|
||||
}
|
||||
}
|
||||
if (newTreeTop && newTreeBottom) {
|
||||
newTreeBottom.appendChild(empty(node));
|
||||
node.appendChild(newTreeTop);
|
||||
if (node.style.cssText) {
|
||||
node.appendChild(newTreeTop);
|
||||
} else {
|
||||
replaceWith(node, newTreeTop);
|
||||
}
|
||||
}
|
||||
return newTreeBottom || node;
|
||||
};
|
||||
|
@ -1705,10 +1715,20 @@ var Backspace = (self, event, range) => {
|
|||
self._updatePath(range, true);
|
||||
}
|
||||
} else {
|
||||
self.setSelection(range);
|
||||
setTimeout(() => {
|
||||
afterDelete(self);
|
||||
}, 0);
|
||||
moveRangeBoundariesDownTree(range);
|
||||
const text = range.startContainer;
|
||||
const offset = range.startOffset;
|
||||
const a = text.parentNode;
|
||||
if (text instanceof Text && a instanceof HTMLAnchorElement && offset && a.href.includes(text.data)) {
|
||||
text.deleteData(offset - 1, 1);
|
||||
self.setSelection(range);
|
||||
self.removeLink();
|
||||
} else {
|
||||
self.setSelection(range);
|
||||
setTimeout(() => {
|
||||
afterDelete(self);
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -2436,12 +2456,17 @@ var Squire = class {
|
|||
} else {
|
||||
const selection = window.getSelection();
|
||||
if (selection) {
|
||||
selection.setBaseAndExtent(
|
||||
range.startContainer,
|
||||
range.startOffset,
|
||||
range.endContainer,
|
||||
range.endOffset
|
||||
);
|
||||
if ("setBaseAndExtent" in Selection.prototype) {
|
||||
selection.setBaseAndExtent(
|
||||
range.startContainer,
|
||||
range.startOffset,
|
||||
range.endContainer,
|
||||
range.endOffset
|
||||
);
|
||||
} else {
|
||||
selection.removeAllRanges();
|
||||
selection.addRange(range);
|
||||
}
|
||||
}
|
||||
}
|
||||
return this;
|
||||
|
|
18
dist/squire.js
vendored
18
dist/squire.js
vendored
File diff suppressed because one or more lines are too long
6
dist/squire.js.map
vendored
6
dist/squire.js.map
vendored
File diff suppressed because one or more lines are too long
18
dist/squire.mjs
vendored
18
dist/squire.mjs
vendored
File diff suppressed because one or more lines are too long
6
dist/squire.mjs.map
vendored
6
dist/squire.mjs.map
vendored
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "squire-rte",
|
||||
"version": "2.0.0",
|
||||
"version": "2.0.1",
|
||||
"description": "Squire is an HTML5 rich text editor, which provides powerful cross-browser normalisation, whilst being supremely lightweight and flexible.",
|
||||
"main": "dist/squire.mjs",
|
||||
"type": "module",
|
||||
|
|
Loading…
Reference in a new issue