easy-email-pro-theme 1.26.2 → 1.26.3
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/lib/index.js +78 -30
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -33874,11 +33874,18 @@ const BgColor = () => {
|
|
|
33874
33874
|
(_a = ref2.current) == null ? void 0 : _a.click();
|
|
33875
33875
|
};
|
|
33876
33876
|
const onChange = (val) => {
|
|
33877
|
-
var _a;
|
|
33877
|
+
var _a, _b;
|
|
33878
|
+
const contentNodeEntry = editor.selection ? editor.findSelfOrAncestorNodeByCategory({
|
|
33879
|
+
category: ElementCategory.TEXT,
|
|
33880
|
+
path: (_a = editor.selection) == null ? void 0 : _a.anchor.path
|
|
33881
|
+
}) : null;
|
|
33882
|
+
if (!contentNodeEntry)
|
|
33883
|
+
return;
|
|
33884
|
+
const contentNodePath = contentNodeEntry[1];
|
|
33878
33885
|
const selection = editor.selection;
|
|
33879
33886
|
const mergeNodeEntry = editor.selection ? editor.findSelfOrAncestorNodeByType({
|
|
33880
33887
|
type: ElementType.MERGETAG,
|
|
33881
|
-
path: (
|
|
33888
|
+
path: (_b = editor.selection) == null ? void 0 : _b.anchor.path
|
|
33882
33889
|
}) : null;
|
|
33883
33890
|
const isCollapsed = Boolean(
|
|
33884
33891
|
selection && (Range.isCollapsed(selection) || Editor.string(editor, selection) === "") && !mergeNodeEntry
|
|
@@ -33897,7 +33904,7 @@ const BgColor = () => {
|
|
|
33897
33904
|
);
|
|
33898
33905
|
} else {
|
|
33899
33906
|
setFieldValue(
|
|
33900
|
-
|
|
33907
|
+
contentNodePath,
|
|
33901
33908
|
"attributes.container-background-color",
|
|
33902
33909
|
val
|
|
33903
33910
|
);
|
|
@@ -33975,11 +33982,18 @@ const FontColor = () => {
|
|
|
33975
33982
|
(_a = ref2.current) == null ? void 0 : _a.click();
|
|
33976
33983
|
};
|
|
33977
33984
|
const onChange = (val) => {
|
|
33978
|
-
var _a;
|
|
33985
|
+
var _a, _b;
|
|
33986
|
+
const contentNodeEntry = editor.selection ? editor.findSelfOrAncestorNodeByCategory({
|
|
33987
|
+
category: ElementCategory.TEXT,
|
|
33988
|
+
path: (_a = editor.selection) == null ? void 0 : _a.anchor.path
|
|
33989
|
+
}) : null;
|
|
33990
|
+
if (!contentNodeEntry)
|
|
33991
|
+
return;
|
|
33992
|
+
const contentNodePath = contentNodeEntry[1];
|
|
33979
33993
|
const selection = editor.selection;
|
|
33980
33994
|
const mergeNodeEntry = editor.selection ? editor.findSelfOrAncestorNodeByType({
|
|
33981
33995
|
type: ElementType.MERGETAG,
|
|
33982
|
-
path: (
|
|
33996
|
+
path: (_b = editor.selection) == null ? void 0 : _b.anchor.path
|
|
33983
33997
|
}) : null;
|
|
33984
33998
|
const isCollapsed = Boolean(
|
|
33985
33999
|
selection && (Range.isCollapsed(selection) || Editor.string(editor, selection) === "") && !mergeNodeEntry
|
|
@@ -33997,7 +34011,7 @@ const FontColor = () => {
|
|
|
33997
34011
|
}
|
|
33998
34012
|
);
|
|
33999
34013
|
} else {
|
|
34000
|
-
setFieldValue(
|
|
34014
|
+
setFieldValue(contentNodePath, "attributes.color", val);
|
|
34001
34015
|
}
|
|
34002
34016
|
};
|
|
34003
34017
|
const color2 = (textNode == null ? void 0 : textNode.color) || elementColor || "";
|
|
@@ -34061,11 +34075,10 @@ const FormatButton = (_k) => {
|
|
|
34061
34075
|
"title"
|
|
34062
34076
|
]);
|
|
34063
34077
|
const { setFieldValue, getFieldValue } = useEditorContext();
|
|
34064
|
-
const { selectedNodePath } = useSelectedNode();
|
|
34065
34078
|
const editor = useSlate();
|
|
34066
34079
|
const active = rest.active || format && isFormatActive(editor, format);
|
|
34067
34080
|
const onClick = () => {
|
|
34068
|
-
var _a;
|
|
34081
|
+
var _a, _b;
|
|
34069
34082
|
if (onClickHandle) {
|
|
34070
34083
|
onClickHandle();
|
|
34071
34084
|
return;
|
|
@@ -34076,57 +34089,64 @@ const FormatButton = (_k) => {
|
|
|
34076
34089
|
type: ElementType.MERGETAG,
|
|
34077
34090
|
path: (_a = editor.selection) == null ? void 0 : _a.anchor.path
|
|
34078
34091
|
}) : null;
|
|
34092
|
+
const contentNodeEntry = editor.selection ? editor.findSelfOrAncestorNodeByCategory({
|
|
34093
|
+
category: ElementCategory.TEXT,
|
|
34094
|
+
path: (_b = editor.selection) == null ? void 0 : _b.anchor.path
|
|
34095
|
+
}) : null;
|
|
34096
|
+
if (!contentNodeEntry)
|
|
34097
|
+
return;
|
|
34098
|
+
const contentNodePath = contentNodeEntry[1];
|
|
34079
34099
|
const selection = editor.selection;
|
|
34080
34100
|
const isCollapsed = Boolean(
|
|
34081
34101
|
selection && (Range.isCollapsed(selection) || Editor.string(editor, selection) === "") && !mergeNodeEntry
|
|
34082
34102
|
);
|
|
34083
34103
|
if (isCollapsed) {
|
|
34084
34104
|
if (format === TextFormat.BOLD) {
|
|
34085
|
-
const val = getFieldValue(
|
|
34105
|
+
const val = getFieldValue(contentNodePath, "attributes.font-weight");
|
|
34086
34106
|
if (val === "bold" || parseInt(val) > 500) {
|
|
34087
|
-
setFieldValue(
|
|
34107
|
+
setFieldValue(contentNodePath, "attributes.font-weight", "normal");
|
|
34088
34108
|
} else {
|
|
34089
|
-
setFieldValue(
|
|
34109
|
+
setFieldValue(contentNodePath, "attributes.font-weight", "600");
|
|
34090
34110
|
}
|
|
34091
34111
|
} else if (format === TextFormat.ITALIC) {
|
|
34092
|
-
const val = getFieldValue(
|
|
34112
|
+
const val = getFieldValue(contentNodePath, "attributes.font-style");
|
|
34093
34113
|
if (val === "italic") {
|
|
34094
|
-
setFieldValue(
|
|
34114
|
+
setFieldValue(contentNodePath, "attributes.font-style", "normal");
|
|
34095
34115
|
} else {
|
|
34096
|
-
setFieldValue(
|
|
34116
|
+
setFieldValue(contentNodePath, "attributes.font-style", "italic");
|
|
34097
34117
|
}
|
|
34098
34118
|
} else if (format === TextFormat.UNDERLINE) {
|
|
34099
34119
|
const val = getFieldValue(
|
|
34100
|
-
|
|
34120
|
+
contentNodePath,
|
|
34101
34121
|
"attributes.text-decoration"
|
|
34102
34122
|
);
|
|
34103
34123
|
if (val === "underline") {
|
|
34104
34124
|
setFieldValue(
|
|
34105
|
-
|
|
34125
|
+
contentNodePath,
|
|
34106
34126
|
"attributes.text-decoration",
|
|
34107
34127
|
void 0
|
|
34108
34128
|
);
|
|
34109
34129
|
} else {
|
|
34110
34130
|
setFieldValue(
|
|
34111
|
-
|
|
34131
|
+
contentNodePath,
|
|
34112
34132
|
"attributes.text-decoration",
|
|
34113
34133
|
"underline"
|
|
34114
34134
|
);
|
|
34115
34135
|
}
|
|
34116
34136
|
} else if (format === TextFormat.STRIKETHROUGH) {
|
|
34117
34137
|
const val = getFieldValue(
|
|
34118
|
-
|
|
34138
|
+
contentNodePath,
|
|
34119
34139
|
"attributes.text-decoration"
|
|
34120
34140
|
);
|
|
34121
34141
|
if (val === "line-through") {
|
|
34122
34142
|
setFieldValue(
|
|
34123
|
-
|
|
34143
|
+
contentNodePath,
|
|
34124
34144
|
"attributes.text-decoration",
|
|
34125
34145
|
void 0
|
|
34126
34146
|
);
|
|
34127
34147
|
} else {
|
|
34128
34148
|
setFieldValue(
|
|
34129
|
-
|
|
34149
|
+
contentNodePath,
|
|
34130
34150
|
"attributes.text-decoration",
|
|
34131
34151
|
"line-through"
|
|
34132
34152
|
);
|
|
@@ -34458,13 +34478,21 @@ const TurnInto = () => {
|
|
|
34458
34478
|
});
|
|
34459
34479
|
const node = nodeEntry == null ? void 0 : nodeEntry[0];
|
|
34460
34480
|
const onChange = (value) => {
|
|
34481
|
+
var _a;
|
|
34482
|
+
const contentNodeEntry = editor.selection ? editor.findSelfOrAncestorNodeByCategory({
|
|
34483
|
+
category: ElementCategory.TEXT,
|
|
34484
|
+
path: (_a = editor.selection) == null ? void 0 : _a.anchor.path
|
|
34485
|
+
}) : null;
|
|
34486
|
+
if (!contentNodeEntry)
|
|
34487
|
+
return;
|
|
34488
|
+
const contentNodePath = contentNodeEntry[1];
|
|
34461
34489
|
Transforms.setNodes(
|
|
34462
34490
|
editor,
|
|
34463
34491
|
{
|
|
34464
34492
|
type: value
|
|
34465
34493
|
},
|
|
34466
34494
|
{
|
|
34467
|
-
at:
|
|
34495
|
+
at: contentNodePath
|
|
34468
34496
|
}
|
|
34469
34497
|
);
|
|
34470
34498
|
Transforms.collapse(editor);
|
|
@@ -34541,13 +34569,21 @@ const TextAlign = () => {
|
|
|
34541
34569
|
const node = match2 == null ? void 0 : match2[0];
|
|
34542
34570
|
const matchAlign = match2 && get(node.attributes, "align");
|
|
34543
34571
|
const onAlignHandle = (align) => {
|
|
34572
|
+
var _a;
|
|
34573
|
+
const contentNodeEntry = editor.selection ? editor.findSelfOrAncestorNodeByCategory({
|
|
34574
|
+
category: ElementCategory.TEXT,
|
|
34575
|
+
path: (_a = editor.selection) == null ? void 0 : _a.anchor.path
|
|
34576
|
+
}) : null;
|
|
34577
|
+
if (!contentNodeEntry)
|
|
34578
|
+
return;
|
|
34579
|
+
const contentNodePath = contentNodeEntry[1];
|
|
34544
34580
|
Transforms.setNodes(
|
|
34545
34581
|
editor,
|
|
34546
34582
|
{
|
|
34547
34583
|
attributes: __spreadProps(__spreadValues({}, node.attributes), { align })
|
|
34548
34584
|
},
|
|
34549
34585
|
{
|
|
34550
|
-
at:
|
|
34586
|
+
at: contentNodePath
|
|
34551
34587
|
}
|
|
34552
34588
|
);
|
|
34553
34589
|
};
|
|
@@ -34579,7 +34615,6 @@ const FontSize$1 = () => {
|
|
|
34579
34615
|
const { fontSizeList } = useEditorProps();
|
|
34580
34616
|
const [fontSizeValue, setFontSizeValue] = useState();
|
|
34581
34617
|
const { setFieldValue } = useEditorContext();
|
|
34582
|
-
const { selectedNodePath } = useSelectedNode();
|
|
34583
34618
|
const editor = useSlate();
|
|
34584
34619
|
const [nodeEntry] = Editor.nodes(editor, {
|
|
34585
34620
|
match: (node) => {
|
|
@@ -34607,11 +34642,18 @@ const FontSize$1 = () => {
|
|
|
34607
34642
|
return [...new Set(list)].sort().map((item2) => ({ label: item2, value: item2 }));
|
|
34608
34643
|
}, [fontSizeList, fontSizeValue]);
|
|
34609
34644
|
const onChange = (val) => {
|
|
34610
|
-
var _a;
|
|
34645
|
+
var _a, _b;
|
|
34646
|
+
const contentNodeEntry = editor.selection ? editor.findSelfOrAncestorNodeByCategory({
|
|
34647
|
+
category: ElementCategory.TEXT,
|
|
34648
|
+
path: (_a = editor.selection) == null ? void 0 : _a.anchor.path
|
|
34649
|
+
}) : null;
|
|
34650
|
+
if (!contentNodeEntry)
|
|
34651
|
+
return;
|
|
34652
|
+
const contentNodePath = contentNodeEntry[1];
|
|
34611
34653
|
const selection = editor.selection;
|
|
34612
34654
|
const mergeNodeEntry = editor.selection ? editor.findSelfOrAncestorNodeByType({
|
|
34613
34655
|
type: ElementType.MERGETAG,
|
|
34614
|
-
path: (
|
|
34656
|
+
path: (_b = editor.selection) == null ? void 0 : _b.anchor.path
|
|
34615
34657
|
}) : null;
|
|
34616
34658
|
const isCollapsed = Boolean(
|
|
34617
34659
|
selection && (Range.isCollapsed(selection) || Editor.string(editor, selection) === "") && !mergeNodeEntry
|
|
@@ -34629,7 +34671,7 @@ const FontSize$1 = () => {
|
|
|
34629
34671
|
}
|
|
34630
34672
|
);
|
|
34631
34673
|
} else {
|
|
34632
|
-
setFieldValue(
|
|
34674
|
+
setFieldValue(contentNodePath, "attributes.font-size", val);
|
|
34633
34675
|
}
|
|
34634
34676
|
};
|
|
34635
34677
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
|
|
@@ -34653,7 +34695,6 @@ const FontFamily$1 = () => {
|
|
|
34653
34695
|
const { fontList } = useFontFamily();
|
|
34654
34696
|
const editor = useSlate();
|
|
34655
34697
|
const { setFieldValue } = useEditorContext();
|
|
34656
|
-
const { selectedNodePath } = useSelectedNode();
|
|
34657
34698
|
const [fontFamilyValue, setFontFamilyValue] = useState();
|
|
34658
34699
|
const [nodeEntry] = Editor.nodes(editor, {
|
|
34659
34700
|
match: (node) => {
|
|
@@ -34682,11 +34723,18 @@ const FontFamily$1 = () => {
|
|
|
34682
34723
|
return list;
|
|
34683
34724
|
}, [fontFamilyValue, fontList]);
|
|
34684
34725
|
const onChange = (val) => {
|
|
34685
|
-
var _a;
|
|
34726
|
+
var _a, _b;
|
|
34727
|
+
const contentNodeEntry = editor.selection ? editor.findSelfOrAncestorNodeByCategory({
|
|
34728
|
+
category: ElementCategory.TEXT,
|
|
34729
|
+
path: (_a = editor.selection) == null ? void 0 : _a.anchor.path
|
|
34730
|
+
}) : null;
|
|
34731
|
+
if (!contentNodeEntry)
|
|
34732
|
+
return;
|
|
34733
|
+
const contentNodePath = contentNodeEntry[1];
|
|
34686
34734
|
const selection = editor.selection;
|
|
34687
34735
|
const mergeNodeEntry = editor.selection ? editor.findSelfOrAncestorNodeByType({
|
|
34688
34736
|
type: ElementType.MERGETAG,
|
|
34689
|
-
path: (
|
|
34737
|
+
path: (_b = editor.selection) == null ? void 0 : _b.anchor.path
|
|
34690
34738
|
}) : null;
|
|
34691
34739
|
const isCollapsed = Boolean(
|
|
34692
34740
|
selection && (Range.isCollapsed(selection) || Editor.string(editor, selection) === "") && !mergeNodeEntry
|
|
@@ -34704,7 +34752,7 @@ const FontFamily$1 = () => {
|
|
|
34704
34752
|
}
|
|
34705
34753
|
);
|
|
34706
34754
|
} else {
|
|
34707
|
-
setFieldValue(
|
|
34755
|
+
setFieldValue(contentNodePath, "attributes.font-family", val);
|
|
34708
34756
|
}
|
|
34709
34757
|
};
|
|
34710
34758
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
|