@overlap/rte 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Editor.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.js +28 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +28 -4
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/content.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -880,9 +880,8 @@ function domToContent(element) {
|
|
|
880
880
|
if (tagName === "input" && el.getAttribute("type") === "checkbox") {
|
|
881
881
|
return null;
|
|
882
882
|
}
|
|
883
|
-
// Handle <br> as empty text
|
|
884
883
|
if (tagName === "br") {
|
|
885
|
-
return
|
|
884
|
+
return { type: "br" };
|
|
886
885
|
}
|
|
887
886
|
if (tagName === "img") {
|
|
888
887
|
const attributes = {};
|
|
@@ -1694,8 +1693,25 @@ function handleMarkdownShortcut(editor, e) {
|
|
|
1694
1693
|
/** Remove the trigger characters from the text node before applying formatting. */
|
|
1695
1694
|
function clearBlockText(textNode, charCount) {
|
|
1696
1695
|
const text = textNode.textContent || "";
|
|
1697
|
-
|
|
1698
|
-
|
|
1696
|
+
const remaining = text.substring(charCount);
|
|
1697
|
+
textNode.textContent = remaining;
|
|
1698
|
+
if (remaining === "") {
|
|
1699
|
+
const parent = textNode.parentElement;
|
|
1700
|
+
if (parent) {
|
|
1701
|
+
parent.removeChild(textNode);
|
|
1702
|
+
const br = document.createElement("br");
|
|
1703
|
+
parent.appendChild(br);
|
|
1704
|
+
const selection = window.getSelection();
|
|
1705
|
+
if (selection) {
|
|
1706
|
+
const range = document.createRange();
|
|
1707
|
+
range.setStart(parent, 0);
|
|
1708
|
+
range.collapse(true);
|
|
1709
|
+
selection.removeAllRanges();
|
|
1710
|
+
selection.addRange(range);
|
|
1711
|
+
}
|
|
1712
|
+
return;
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1699
1715
|
const selection = window.getSelection();
|
|
1700
1716
|
if (selection) {
|
|
1701
1717
|
const range = document.createRange();
|
|
@@ -5152,10 +5168,18 @@ const Editor = ({ initialContent, onChange, plugins: providedPlugins, placeholde
|
|
|
5152
5168
|
{
|
|
5153
5169
|
"--rte-button-hover-bg": theme.buttonHoverBg,
|
|
5154
5170
|
}),
|
|
5171
|
+
...(theme.buttonActiveBg &&
|
|
5172
|
+
{
|
|
5173
|
+
"--rte-button-active-bg": theme.buttonActiveBg,
|
|
5174
|
+
}),
|
|
5155
5175
|
...(theme.contentBg &&
|
|
5156
5176
|
{
|
|
5157
5177
|
"--rte-content-bg": theme.contentBg,
|
|
5158
5178
|
}),
|
|
5179
|
+
...(theme.textColor &&
|
|
5180
|
+
{
|
|
5181
|
+
"--rte-text-color": theme.textColor,
|
|
5182
|
+
}),
|
|
5159
5183
|
...(theme.primaryColor &&
|
|
5160
5184
|
{
|
|
5161
5185
|
"--rte-primary-color": theme.primaryColor,
|