@mhamz.01/easyflow-texteditor 0.1.86 → 0.1.88
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/index.css +240 -176
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +182 -161
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +201 -180
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1270,7 +1270,7 @@ function EditorLayout({ children, onChange, initialTabs, onTabsChange }) {
|
|
|
1270
1270
|
}
|
|
1271
1271
|
|
|
1272
1272
|
// src/components/tiptap-templates/simple/simple-editor.tsx
|
|
1273
|
-
import { useEffect as
|
|
1273
|
+
import { useEffect as useEffect24, useRef as useRef7, useState as useState33 } from "react";
|
|
1274
1274
|
import { EditorContent, EditorContext, useEditor } from "@tiptap/react";
|
|
1275
1275
|
import { StarterKit } from "@tiptap/starter-kit";
|
|
1276
1276
|
import Image from "@tiptap/extension-image";
|
|
@@ -6711,44 +6711,189 @@ function useUndoRedo(config) {
|
|
|
6711
6711
|
|
|
6712
6712
|
// src/components/tiptap-ui/font-family-dropdown/font-family-dropdown.tsx
|
|
6713
6713
|
import { useCurrentEditor as useCurrentEditor3 } from "@tiptap/react";
|
|
6714
|
-
import { useState as useState28 } from "react";
|
|
6714
|
+
import { useState as useState28, useEffect as useEffect18 } from "react";
|
|
6715
|
+
|
|
6716
|
+
// src/lib/colors.ts
|
|
6717
|
+
var GRADIENT_ROWS_70 = [
|
|
6718
|
+
// ROW 1 — GRAY (Neutral gradient)
|
|
6719
|
+
"#ffffff",
|
|
6720
|
+
"#f2f2f2",
|
|
6721
|
+
"#e6e6e6",
|
|
6722
|
+
"#cccccc",
|
|
6723
|
+
"#b3b3b3",
|
|
6724
|
+
"#999999",
|
|
6725
|
+
"#808080",
|
|
6726
|
+
"#666666",
|
|
6727
|
+
"#4d4d4d",
|
|
6728
|
+
"#333333",
|
|
6729
|
+
// ROW 2 — RED
|
|
6730
|
+
"#ffe8e8",
|
|
6731
|
+
"#ffc4c4",
|
|
6732
|
+
"#ff9e9e",
|
|
6733
|
+
"#ff7878",
|
|
6734
|
+
"#ff5252",
|
|
6735
|
+
"#ff2d2d",
|
|
6736
|
+
"#ff0707",
|
|
6737
|
+
"#d30000",
|
|
6738
|
+
"#a80000",
|
|
6739
|
+
"#7d0000",
|
|
6740
|
+
// ROW 3 — ORANGE
|
|
6741
|
+
"#fff1e0",
|
|
6742
|
+
"#ffd9b3",
|
|
6743
|
+
"#ffc285",
|
|
6744
|
+
"#ffab57",
|
|
6745
|
+
"#ff9429",
|
|
6746
|
+
"#ff7d00",
|
|
6747
|
+
"#e66700",
|
|
6748
|
+
"#cc5500",
|
|
6749
|
+
"#b24400",
|
|
6750
|
+
"#803000",
|
|
6751
|
+
// ROW 4 — YELLOW
|
|
6752
|
+
"#fffbe0",
|
|
6753
|
+
"#fff4b3",
|
|
6754
|
+
"#ffec85",
|
|
6755
|
+
"#ffe457",
|
|
6756
|
+
"#ffdc29",
|
|
6757
|
+
"#ffd400",
|
|
6758
|
+
"#e6be00",
|
|
6759
|
+
"#cca900",
|
|
6760
|
+
"#b39400",
|
|
6761
|
+
"#806e00",
|
|
6762
|
+
// ROW 5 — GREEN
|
|
6763
|
+
"#e7ffe8",
|
|
6764
|
+
"#c4ffc7",
|
|
6765
|
+
"#9effa5",
|
|
6766
|
+
"#78ff83",
|
|
6767
|
+
"#52ff61",
|
|
6768
|
+
"#2dff3f",
|
|
6769
|
+
"#0afc22",
|
|
6770
|
+
"#00d51d",
|
|
6771
|
+
"#00ad18",
|
|
6772
|
+
"#008512",
|
|
6773
|
+
// ROW 6 — BLUE
|
|
6774
|
+
"#e4f2ff",
|
|
6775
|
+
"#bcdcff",
|
|
6776
|
+
"#94c5ff",
|
|
6777
|
+
"#6badff",
|
|
6778
|
+
"#4396ff",
|
|
6779
|
+
"#1b7eff",
|
|
6780
|
+
"#0065e6",
|
|
6781
|
+
"#0054bf",
|
|
6782
|
+
"#004499",
|
|
6783
|
+
"#003373",
|
|
6784
|
+
// ROW 7 — PURPLE
|
|
6785
|
+
"#f3e6ff",
|
|
6786
|
+
"#dfb5ff",
|
|
6787
|
+
"#cb85ff",
|
|
6788
|
+
"#b755ff",
|
|
6789
|
+
"#a326ff",
|
|
6790
|
+
"#8a0dff",
|
|
6791
|
+
"#7600e6",
|
|
6792
|
+
"#6300bf",
|
|
6793
|
+
"#4f0099",
|
|
6794
|
+
"#3c0073"
|
|
6795
|
+
];
|
|
6796
|
+
|
|
6797
|
+
// src/lib/editorStorage.ts
|
|
6798
|
+
var STORAGE_KEY = "tiptap-tabs-v1";
|
|
6799
|
+
var ACTIVE_TAB_KEY = "tiptap-active-tab";
|
|
6800
|
+
function loadTabs() {
|
|
6801
|
+
if (typeof window === "undefined") return [];
|
|
6802
|
+
try {
|
|
6803
|
+
const raw = localStorage.getItem("tiptap-tabs-v1");
|
|
6804
|
+
if (!raw) return [];
|
|
6805
|
+
const parsed = JSON.parse(raw);
|
|
6806
|
+
if (!Array.isArray(parsed)) return [];
|
|
6807
|
+
return parsed;
|
|
6808
|
+
} catch {
|
|
6809
|
+
return [];
|
|
6810
|
+
}
|
|
6811
|
+
}
|
|
6812
|
+
function saveTabs(tabs) {
|
|
6813
|
+
if (typeof window === "undefined") return;
|
|
6814
|
+
localStorage.setItem(STORAGE_KEY, JSON.stringify(tabs));
|
|
6815
|
+
}
|
|
6816
|
+
function loadActiveTab() {
|
|
6817
|
+
if (typeof window === "undefined") return "1";
|
|
6818
|
+
return localStorage.getItem(ACTIVE_TAB_KEY) ?? "1";
|
|
6819
|
+
}
|
|
6820
|
+
function saveActiveTab(id) {
|
|
6821
|
+
if (typeof window === "undefined") return;
|
|
6822
|
+
localStorage.setItem(ACTIVE_TAB_KEY, id);
|
|
6823
|
+
}
|
|
6715
6824
|
|
|
6716
6825
|
// src/lib/font.ts
|
|
6717
6826
|
var FONT_OPTIONS = [
|
|
6718
|
-
{ label: "Inter", cssFontFamily: "Inter" },
|
|
6719
|
-
{ label: "Roboto", cssFontFamily: "Roboto" },
|
|
6720
|
-
{ label: "Open Sans", cssFontFamily: "
|
|
6721
|
-
{ label: "Poppins", cssFontFamily: "Poppins" },
|
|
6722
|
-
{ label: "Montserrat", cssFontFamily: "Montserrat" },
|
|
6723
|
-
{ label: "Lato", cssFontFamily: "Lato" },
|
|
6724
|
-
{ label: "Oswald", cssFontFamily: "Oswald" },
|
|
6725
|
-
{ label: "Raleway", cssFontFamily: "Raleway" },
|
|
6726
|
-
{ label: "Merriweather", cssFontFamily: "Merriweather" },
|
|
6727
|
-
{ label: "Playfair Display", cssFontFamily: "Playfair" },
|
|
6728
|
-
{ label: "Ubuntu", cssFontFamily: "Ubuntu" },
|
|
6729
|
-
{ label: "PT Sans", cssFontFamily: "
|
|
6730
|
-
{ label: "Barlow", cssFontFamily: "Barlow" },
|
|
6731
|
-
{ label: "Fira Sans", cssFontFamily: "Fira" },
|
|
6732
|
-
{ label: "Nunito", cssFontFamily: "Nunito" },
|
|
6733
|
-
{ label: "Cabin", cssFontFamily: "Cabin" },
|
|
6734
|
-
{ label: "Bebas Neue", cssFontFamily: "Bebas" },
|
|
6735
|
-
{ label: "Source Serif Pro", cssFontFamily: "
|
|
6736
|
-
{ label: "Libre Baskerville", cssFontFamily: "
|
|
6737
|
-
{ label: "Rubik", cssFontFamily: "Rubik" },
|
|
6738
|
-
{ label: "Inconsolata", cssFontFamily: "Inconsolata" },
|
|
6739
|
-
{ label: "Work Sans", cssFontFamily: "
|
|
6740
|
-
{ label: "Mulish", cssFontFamily: "Mulish" },
|
|
6741
|
-
{ label: "Quicksand", cssFontFamily: "Quicksand" },
|
|
6742
|
-
{ label: "Kanit", cssFontFamily: "Kanit" },
|
|
6743
|
-
{ label: "Teko", cssFontFamily: "Teko" },
|
|
6744
|
-
{ label: "Josefin Sans", cssFontFamily: "Josefin" },
|
|
6745
|
-
{ label: "Philosopher", cssFontFamily: "Philosopher" },
|
|
6746
|
-
{ label: "Dancing Script", cssFontFamily: "Dancing" },
|
|
6747
|
-
{ label: "Noto Serif", cssFontFamily: "
|
|
6748
|
-
{ label: "Manrope", cssFontFamily: "Manrope" },
|
|
6749
|
-
{ label: "Space Grotesk", cssFontFamily: "
|
|
6827
|
+
{ label: "Inter", cssFontFamily: "Inter, sans-serif", googleFontName: "Inter" },
|
|
6828
|
+
{ label: "Roboto", cssFontFamily: "Roboto, sans-serif", googleFontName: "Roboto" },
|
|
6829
|
+
{ label: "Open Sans", cssFontFamily: "'Open Sans', sans-serif", googleFontName: "Open+Sans" },
|
|
6830
|
+
{ label: "Poppins", cssFontFamily: "Poppins, sans-serif", googleFontName: "Poppins" },
|
|
6831
|
+
{ label: "Montserrat", cssFontFamily: "Montserrat, sans-serif", googleFontName: "Montserrat" },
|
|
6832
|
+
{ label: "Lato", cssFontFamily: "Lato, sans-serif", googleFontName: "Lato" },
|
|
6833
|
+
{ label: "Oswald", cssFontFamily: "Oswald, sans-serif", googleFontName: "Oswald" },
|
|
6834
|
+
{ label: "Raleway", cssFontFamily: "Raleway, sans-serif", googleFontName: "Raleway" },
|
|
6835
|
+
{ label: "Merriweather", cssFontFamily: "Merriweather, serif", googleFontName: "Merriweather" },
|
|
6836
|
+
{ label: "Playfair Display", cssFontFamily: "'Playfair Display', serif", googleFontName: "Playfair+Display" },
|
|
6837
|
+
{ label: "Ubuntu", cssFontFamily: "Ubuntu, sans-serif", googleFontName: "Ubuntu" },
|
|
6838
|
+
{ label: "PT Sans", cssFontFamily: "'PT Sans', sans-serif", googleFontName: "PT+Sans" },
|
|
6839
|
+
{ label: "Barlow", cssFontFamily: "Barlow, sans-serif", googleFontName: "Barlow" },
|
|
6840
|
+
{ label: "Fira Sans", cssFontFamily: "'Fira Sans', sans-serif", googleFontName: "Fira+Sans" },
|
|
6841
|
+
{ label: "Nunito", cssFontFamily: "Nunito, sans-serif", googleFontName: "Nunito" },
|
|
6842
|
+
{ label: "Cabin", cssFontFamily: "Cabin, sans-serif", googleFontName: "Cabin" },
|
|
6843
|
+
{ label: "Bebas Neue", cssFontFamily: "'Bebas Neue', cursive", googleFontName: "Bebas+Neue" },
|
|
6844
|
+
{ label: "Source Serif Pro", cssFontFamily: "'Source Serif Pro', serif", googleFontName: "Source+Serif+Pro" },
|
|
6845
|
+
{ label: "Libre Baskerville", cssFontFamily: "'Libre Baskerville', serif", googleFontName: "Libre+Baskerville" },
|
|
6846
|
+
{ label: "Rubik", cssFontFamily: "Rubik, sans-serif", googleFontName: "Rubik" },
|
|
6847
|
+
{ label: "Inconsolata", cssFontFamily: "Inconsolata, monospace", googleFontName: "Inconsolata" },
|
|
6848
|
+
{ label: "Work Sans", cssFontFamily: "'Work Sans', sans-serif", googleFontName: "Work+Sans" },
|
|
6849
|
+
{ label: "Mulish", cssFontFamily: "Mulish, sans-serif", googleFontName: "Mulish" },
|
|
6850
|
+
{ label: "Quicksand", cssFontFamily: "Quicksand, sans-serif", googleFontName: "Quicksand" },
|
|
6851
|
+
{ label: "Kanit", cssFontFamily: "Kanit, sans-serif", googleFontName: "Kanit" },
|
|
6852
|
+
{ label: "Teko", cssFontFamily: "Teko, sans-serif", googleFontName: "Teko" },
|
|
6853
|
+
{ label: "Josefin Sans", cssFontFamily: "'Josefin Sans', sans-serif", googleFontName: "Josefin+Sans" },
|
|
6854
|
+
{ label: "Philosopher", cssFontFamily: "Philosopher, sans-serif", googleFontName: "Philosopher" },
|
|
6855
|
+
{ label: "Dancing Script", cssFontFamily: "'Dancing Script', cursive", googleFontName: "Dancing+Script" },
|
|
6856
|
+
{ label: "Noto Serif", cssFontFamily: "'Noto Serif', serif", googleFontName: "Noto+Serif" },
|
|
6857
|
+
{ label: "Manrope", cssFontFamily: "Manrope, sans-serif", googleFontName: "Manrope" },
|
|
6858
|
+
{ label: "Space Grotesk", cssFontFamily: "'Space Grotesk', sans-serif", googleFontName: "Space+Grotesk" }
|
|
6750
6859
|
];
|
|
6751
6860
|
|
|
6861
|
+
// src/lib/local-image.ts
|
|
6862
|
+
function fileToBase64(file) {
|
|
6863
|
+
return new Promise((resolve, reject) => {
|
|
6864
|
+
const reader = new FileReader();
|
|
6865
|
+
reader.readAsDataURL(file);
|
|
6866
|
+
reader.onload = () => resolve(reader.result);
|
|
6867
|
+
reader.onerror = (error) => reject(error);
|
|
6868
|
+
});
|
|
6869
|
+
}
|
|
6870
|
+
function saveImageBase64(key, base64) {
|
|
6871
|
+
localStorage.setItem(key, base64);
|
|
6872
|
+
}
|
|
6873
|
+
function loadImageBase64(key) {
|
|
6874
|
+
return localStorage.getItem(key);
|
|
6875
|
+
}
|
|
6876
|
+
|
|
6877
|
+
// src/lib/font-loader.ts
|
|
6878
|
+
var fontsLoaded = false;
|
|
6879
|
+
function loadGoogleFonts() {
|
|
6880
|
+
if (fontsLoaded || typeof document === "undefined") return;
|
|
6881
|
+
const fontNames = FONT_OPTIONS.filter((font) => font.googleFontName).map((font) => font.googleFontName);
|
|
6882
|
+
if (fontNames.length === 0) return;
|
|
6883
|
+
const fontFamilies = fontNames.join("&family=");
|
|
6884
|
+
const googleFontsUrl = `https://fonts.googleapis.com/css2?family=${fontFamilies}&display=swap`;
|
|
6885
|
+
const existingLink = document.querySelector(`link[href*="fonts.googleapis.com"]`);
|
|
6886
|
+
if (existingLink) {
|
|
6887
|
+
fontsLoaded = true;
|
|
6888
|
+
return;
|
|
6889
|
+
}
|
|
6890
|
+
const link = document.createElement("link");
|
|
6891
|
+
link.rel = "stylesheet";
|
|
6892
|
+
link.href = googleFontsUrl;
|
|
6893
|
+
document.head.appendChild(link);
|
|
6894
|
+
fontsLoaded = true;
|
|
6895
|
+
}
|
|
6896
|
+
|
|
6752
6897
|
// src/components/tiptap-ui/font-family-dropdown/font-family-dropdown.tsx
|
|
6753
6898
|
import { ChevronDown } from "lucide-react";
|
|
6754
6899
|
|
|
@@ -6898,6 +7043,9 @@ import { jsx as jsx76, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
|
6898
7043
|
function FontFamilyDropdown() {
|
|
6899
7044
|
const { editor } = useCurrentEditor3();
|
|
6900
7045
|
const [open, setOpen] = useState28(false);
|
|
7046
|
+
useEffect18(() => {
|
|
7047
|
+
loadGoogleFonts();
|
|
7048
|
+
}, []);
|
|
6901
7049
|
if (!editor) return null;
|
|
6902
7050
|
const currentFont = editor.getAttributes("textStyle").fontFamily || "Font Family";
|
|
6903
7051
|
const applyFont = (family) => {
|
|
@@ -6920,7 +7068,7 @@ function FontFamilyDropdown() {
|
|
|
6920
7068
|
Button,
|
|
6921
7069
|
{
|
|
6922
7070
|
variant: "outlineFontFamily",
|
|
6923
|
-
className: "
|
|
7071
|
+
className: "min-w-[90px] h-7 px-2 flex items-center justify-between rounded-sm border-[#a3a3a8] text-[#a3a3a8] hover:border-[#000] hover:text-[#fff] transition-colors",
|
|
6924
7072
|
children: [
|
|
6925
7073
|
currentFont,
|
|
6926
7074
|
/* @__PURE__ */ jsx76(ChevronDown, { className: "w-4 h-4" })
|
|
@@ -6970,7 +7118,7 @@ function FontFamilyDropdown() {
|
|
|
6970
7118
|
CommandItem,
|
|
6971
7119
|
{
|
|
6972
7120
|
onSelect: () => {
|
|
6973
|
-
applyFont(
|
|
7121
|
+
applyFont(cssFontFamily);
|
|
6974
7122
|
setOpen(false);
|
|
6975
7123
|
},
|
|
6976
7124
|
style: { fontFamily: cssFontFamily },
|
|
@@ -6987,92 +7135,9 @@ function FontFamilyDropdown() {
|
|
|
6987
7135
|
}
|
|
6988
7136
|
|
|
6989
7137
|
// src/components/tiptap-ui/color-picker/color-picker.tsx
|
|
6990
|
-
import { useState as useState29, useEffect as
|
|
7138
|
+
import { useState as useState29, useEffect as useEffect19 } from "react";
|
|
6991
7139
|
import { useCurrentEditor as useCurrentEditor4 } from "@tiptap/react";
|
|
6992
7140
|
import { HexColorPicker } from "react-colorful";
|
|
6993
|
-
|
|
6994
|
-
// src/lib/colors.ts
|
|
6995
|
-
var GRADIENT_ROWS_70 = [
|
|
6996
|
-
// ROW 1 — GRAY (Neutral gradient)
|
|
6997
|
-
"#ffffff",
|
|
6998
|
-
"#f2f2f2",
|
|
6999
|
-
"#e6e6e6",
|
|
7000
|
-
"#cccccc",
|
|
7001
|
-
"#b3b3b3",
|
|
7002
|
-
"#999999",
|
|
7003
|
-
"#808080",
|
|
7004
|
-
"#666666",
|
|
7005
|
-
"#4d4d4d",
|
|
7006
|
-
"#333333",
|
|
7007
|
-
// ROW 2 — RED
|
|
7008
|
-
"#ffe8e8",
|
|
7009
|
-
"#ffc4c4",
|
|
7010
|
-
"#ff9e9e",
|
|
7011
|
-
"#ff7878",
|
|
7012
|
-
"#ff5252",
|
|
7013
|
-
"#ff2d2d",
|
|
7014
|
-
"#ff0707",
|
|
7015
|
-
"#d30000",
|
|
7016
|
-
"#a80000",
|
|
7017
|
-
"#7d0000",
|
|
7018
|
-
// ROW 3 — ORANGE
|
|
7019
|
-
"#fff1e0",
|
|
7020
|
-
"#ffd9b3",
|
|
7021
|
-
"#ffc285",
|
|
7022
|
-
"#ffab57",
|
|
7023
|
-
"#ff9429",
|
|
7024
|
-
"#ff7d00",
|
|
7025
|
-
"#e66700",
|
|
7026
|
-
"#cc5500",
|
|
7027
|
-
"#b24400",
|
|
7028
|
-
"#803000",
|
|
7029
|
-
// ROW 4 — YELLOW
|
|
7030
|
-
"#fffbe0",
|
|
7031
|
-
"#fff4b3",
|
|
7032
|
-
"#ffec85",
|
|
7033
|
-
"#ffe457",
|
|
7034
|
-
"#ffdc29",
|
|
7035
|
-
"#ffd400",
|
|
7036
|
-
"#e6be00",
|
|
7037
|
-
"#cca900",
|
|
7038
|
-
"#b39400",
|
|
7039
|
-
"#806e00",
|
|
7040
|
-
// ROW 5 — GREEN
|
|
7041
|
-
"#e7ffe8",
|
|
7042
|
-
"#c4ffc7",
|
|
7043
|
-
"#9effa5",
|
|
7044
|
-
"#78ff83",
|
|
7045
|
-
"#52ff61",
|
|
7046
|
-
"#2dff3f",
|
|
7047
|
-
"#0afc22",
|
|
7048
|
-
"#00d51d",
|
|
7049
|
-
"#00ad18",
|
|
7050
|
-
"#008512",
|
|
7051
|
-
// ROW 6 — BLUE
|
|
7052
|
-
"#e4f2ff",
|
|
7053
|
-
"#bcdcff",
|
|
7054
|
-
"#94c5ff",
|
|
7055
|
-
"#6badff",
|
|
7056
|
-
"#4396ff",
|
|
7057
|
-
"#1b7eff",
|
|
7058
|
-
"#0065e6",
|
|
7059
|
-
"#0054bf",
|
|
7060
|
-
"#004499",
|
|
7061
|
-
"#003373",
|
|
7062
|
-
// ROW 7 — PURPLE
|
|
7063
|
-
"#f3e6ff",
|
|
7064
|
-
"#dfb5ff",
|
|
7065
|
-
"#cb85ff",
|
|
7066
|
-
"#b755ff",
|
|
7067
|
-
"#a326ff",
|
|
7068
|
-
"#8a0dff",
|
|
7069
|
-
"#7600e6",
|
|
7070
|
-
"#6300bf",
|
|
7071
|
-
"#4f0099",
|
|
7072
|
-
"#3c0073"
|
|
7073
|
-
];
|
|
7074
|
-
|
|
7075
|
-
// src/components/tiptap-ui/color-picker/color-picker.tsx
|
|
7076
7141
|
import { debounce } from "lodash";
|
|
7077
7142
|
|
|
7078
7143
|
// src/components/ui/label.tsx
|
|
@@ -7105,12 +7170,12 @@ function ColorPicker({ type = "text" }) {
|
|
|
7105
7170
|
const [showCustom, setShowCustom] = useState29(false);
|
|
7106
7171
|
const [tempHex, setTempHex] = useState29("#000000");
|
|
7107
7172
|
const [canApply, setCanApply] = useState29(false);
|
|
7108
|
-
|
|
7173
|
+
useEffect19(() => {
|
|
7109
7174
|
const current = type === "text" ? editor?.getAttributes("textStyle").color || "#000000" : editor?.getAttributes("highlight")?.color || "#FFFF00";
|
|
7110
7175
|
setColor(current);
|
|
7111
7176
|
setTempHex(current);
|
|
7112
7177
|
}, [editor, type]);
|
|
7113
|
-
|
|
7178
|
+
useEffect19(() => {
|
|
7114
7179
|
const check = () => {
|
|
7115
7180
|
try {
|
|
7116
7181
|
setCanApply(!editor?.state.selection.empty);
|
|
@@ -7363,17 +7428,17 @@ var ArrowLeftIcon = memo39(({ className, ...props }) => {
|
|
|
7363
7428
|
ArrowLeftIcon.displayName = "ArrowLeftIcon";
|
|
7364
7429
|
|
|
7365
7430
|
// src/hooks/use-window-size.ts
|
|
7366
|
-
import { useEffect as
|
|
7431
|
+
import { useEffect as useEffect21, useState as useState31 } from "react";
|
|
7367
7432
|
|
|
7368
7433
|
// src/hooks/use-throttled-callback.ts
|
|
7369
7434
|
import throttle from "lodash.throttle";
|
|
7370
7435
|
|
|
7371
7436
|
// src/hooks/use-unmount.ts
|
|
7372
|
-
import { useRef as useRef6, useEffect as
|
|
7437
|
+
import { useRef as useRef6, useEffect as useEffect20 } from "react";
|
|
7373
7438
|
var useUnmount = (callback) => {
|
|
7374
7439
|
const ref = useRef6(callback);
|
|
7375
7440
|
ref.current = callback;
|
|
7376
|
-
|
|
7441
|
+
useEffect20(
|
|
7377
7442
|
() => () => {
|
|
7378
7443
|
ref.current();
|
|
7379
7444
|
},
|
|
@@ -7426,7 +7491,7 @@ function useWindowSize() {
|
|
|
7426
7491
|
return { width, height, offsetTop, offsetLeft, scale };
|
|
7427
7492
|
});
|
|
7428
7493
|
}, 200);
|
|
7429
|
-
|
|
7494
|
+
useEffect21(() => {
|
|
7430
7495
|
const visualViewport = window.visualViewport;
|
|
7431
7496
|
if (!visualViewport) return;
|
|
7432
7497
|
visualViewport.addEventListener("resize", handleViewportChange);
|
|
@@ -7439,7 +7504,7 @@ function useWindowSize() {
|
|
|
7439
7504
|
}
|
|
7440
7505
|
|
|
7441
7506
|
// src/hooks/use-element-rect.ts
|
|
7442
|
-
import { useCallback as useCallback28, useEffect as
|
|
7507
|
+
import { useCallback as useCallback28, useEffect as useEffect22, useState as useState32 } from "react";
|
|
7443
7508
|
var initialRect = {
|
|
7444
7509
|
x: 0,
|
|
7445
7510
|
y: 0,
|
|
@@ -7497,7 +7562,7 @@ function useElementRect({
|
|
|
7497
7562
|
[enabled, getTargetElement],
|
|
7498
7563
|
{ leading: true, trailing: true }
|
|
7499
7564
|
);
|
|
7500
|
-
|
|
7565
|
+
useEffect22(() => {
|
|
7501
7566
|
if (!enabled || !isClientSide()) {
|
|
7502
7567
|
setRect(initialRect);
|
|
7503
7568
|
return;
|
|
@@ -7538,7 +7603,7 @@ function useRefRect(ref, options = {}) {
|
|
|
7538
7603
|
}
|
|
7539
7604
|
|
|
7540
7605
|
// src/hooks/use-cursor-visibility.ts
|
|
7541
|
-
import { useEffect as
|
|
7606
|
+
import { useEffect as useEffect23 } from "react";
|
|
7542
7607
|
function useCursorVisibility({
|
|
7543
7608
|
editor,
|
|
7544
7609
|
overlayHeight = 0
|
|
@@ -7549,7 +7614,7 @@ function useCursorVisibility({
|
|
|
7549
7614
|
throttleMs: 100,
|
|
7550
7615
|
useResizeObserver: true
|
|
7551
7616
|
});
|
|
7552
|
-
|
|
7617
|
+
useEffect23(() => {
|
|
7553
7618
|
const ensureCursorVisibility = () => {
|
|
7554
7619
|
if (!editor) return;
|
|
7555
7620
|
const { state, view } = editor;
|
|
@@ -7704,7 +7769,7 @@ function SimpleEditor() {
|
|
|
7704
7769
|
debouncedSave(editor2);
|
|
7705
7770
|
}
|
|
7706
7771
|
});
|
|
7707
|
-
|
|
7772
|
+
useEffect24(() => {
|
|
7708
7773
|
if (editor) {
|
|
7709
7774
|
console.log("\u{1F527} Setting editor content in context");
|
|
7710
7775
|
setEditorContent(editor);
|
|
@@ -7714,17 +7779,17 @@ function SimpleEditor() {
|
|
|
7714
7779
|
editor,
|
|
7715
7780
|
overlayHeight: toolbarRef.current?.getBoundingClientRect().height ?? 0
|
|
7716
7781
|
});
|
|
7717
|
-
|
|
7782
|
+
useEffect24(() => {
|
|
7718
7783
|
if (!isMobile && mobileView !== "main") {
|
|
7719
7784
|
setMobileView("main");
|
|
7720
7785
|
}
|
|
7721
7786
|
}, [isMobile, mobileView]);
|
|
7722
|
-
|
|
7787
|
+
useEffect24(() => {
|
|
7723
7788
|
if (editor) {
|
|
7724
7789
|
editor.commands.focus("start");
|
|
7725
7790
|
}
|
|
7726
7791
|
}, [editor]);
|
|
7727
|
-
|
|
7792
|
+
useEffect24(() => {
|
|
7728
7793
|
if (!window?.visualViewport) return;
|
|
7729
7794
|
const toolbar = document.querySelector(
|
|
7730
7795
|
".tiptap-toolbar[data-variant='fixed']"
|
|
@@ -7798,11 +7863,11 @@ function Editor({ onChange, className, style, onTabsChange, initialTabs }) {
|
|
|
7798
7863
|
}
|
|
7799
7864
|
|
|
7800
7865
|
// src/hooks/use-scrolling.ts
|
|
7801
|
-
import { useEffect as
|
|
7866
|
+
import { useEffect as useEffect25, useState as useState34 } from "react";
|
|
7802
7867
|
function useScrolling(target, options = {}) {
|
|
7803
7868
|
const { debounce: debounce2 = 150, fallbackToDocument = true } = options;
|
|
7804
7869
|
const [isScrolling, setIsScrolling] = useState34(false);
|
|
7805
|
-
|
|
7870
|
+
useEffect25(() => {
|
|
7806
7871
|
const element = target && typeof Window !== "undefined" && target instanceof Window ? target : target?.current ?? window;
|
|
7807
7872
|
const eventTarget = fallbackToDocument && element === window && typeof document !== "undefined" ? document : element;
|
|
7808
7873
|
const on = (el, event, handler) => el.addEventListener(event, handler, true);
|
|
@@ -7831,50 +7896,6 @@ function useScrolling(target, options = {}) {
|
|
|
7831
7896
|
}, [target, debounce2, fallbackToDocument, isScrolling]);
|
|
7832
7897
|
return isScrolling;
|
|
7833
7898
|
}
|
|
7834
|
-
|
|
7835
|
-
// src/lib/editorStorage.ts
|
|
7836
|
-
var STORAGE_KEY = "tiptap-tabs-v1";
|
|
7837
|
-
var ACTIVE_TAB_KEY = "tiptap-active-tab";
|
|
7838
|
-
function loadTabs() {
|
|
7839
|
-
if (typeof window === "undefined") return [];
|
|
7840
|
-
try {
|
|
7841
|
-
const raw = localStorage.getItem("tiptap-tabs-v1");
|
|
7842
|
-
if (!raw) return [];
|
|
7843
|
-
const parsed = JSON.parse(raw);
|
|
7844
|
-
if (!Array.isArray(parsed)) return [];
|
|
7845
|
-
return parsed;
|
|
7846
|
-
} catch {
|
|
7847
|
-
return [];
|
|
7848
|
-
}
|
|
7849
|
-
}
|
|
7850
|
-
function saveTabs(tabs) {
|
|
7851
|
-
if (typeof window === "undefined") return;
|
|
7852
|
-
localStorage.setItem(STORAGE_KEY, JSON.stringify(tabs));
|
|
7853
|
-
}
|
|
7854
|
-
function loadActiveTab() {
|
|
7855
|
-
if (typeof window === "undefined") return "1";
|
|
7856
|
-
return localStorage.getItem(ACTIVE_TAB_KEY) ?? "1";
|
|
7857
|
-
}
|
|
7858
|
-
function saveActiveTab(id) {
|
|
7859
|
-
if (typeof window === "undefined") return;
|
|
7860
|
-
localStorage.setItem(ACTIVE_TAB_KEY, id);
|
|
7861
|
-
}
|
|
7862
|
-
|
|
7863
|
-
// src/lib/local-image.ts
|
|
7864
|
-
function fileToBase64(file) {
|
|
7865
|
-
return new Promise((resolve, reject) => {
|
|
7866
|
-
const reader = new FileReader();
|
|
7867
|
-
reader.readAsDataURL(file);
|
|
7868
|
-
reader.onload = () => resolve(reader.result);
|
|
7869
|
-
reader.onerror = (error) => reject(error);
|
|
7870
|
-
});
|
|
7871
|
-
}
|
|
7872
|
-
function saveImageBase64(key, base64) {
|
|
7873
|
-
localStorage.setItem(key, base64);
|
|
7874
|
-
}
|
|
7875
|
-
function loadImageBase64(key) {
|
|
7876
|
-
return localStorage.getItem(key);
|
|
7877
|
-
}
|
|
7878
7899
|
export {
|
|
7879
7900
|
Editor,
|
|
7880
7901
|
EditorBridgeProvider,
|