@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.d.mts CHANGED
@@ -278,6 +278,7 @@ declare function saveActiveTab(id: string): void;
278
278
  type FontOption = {
279
279
  label: string;
280
280
  cssFontFamily: string;
281
+ googleFontName?: string;
281
282
  };
282
283
  declare const FONT_OPTIONS: FontOption[];
283
284
 
package/dist/index.d.ts CHANGED
@@ -278,6 +278,7 @@ declare function saveActiveTab(id: string): void;
278
278
  type FontOption = {
279
279
  label: string;
280
280
  cssFontFamily: string;
281
+ googleFontName?: string;
281
282
  };
282
283
  declare const FONT_OPTIONS: FontOption[];
283
284
 
package/dist/index.js CHANGED
@@ -6739,42 +6739,187 @@ function useUndoRedo(config) {
6739
6739
  var import_react85 = require("@tiptap/react");
6740
6740
  var import_react86 = require("react");
6741
6741
 
6742
+ // src/lib/colors.ts
6743
+ var GRADIENT_ROWS_70 = [
6744
+ // ROW 1 — GRAY (Neutral gradient)
6745
+ "#ffffff",
6746
+ "#f2f2f2",
6747
+ "#e6e6e6",
6748
+ "#cccccc",
6749
+ "#b3b3b3",
6750
+ "#999999",
6751
+ "#808080",
6752
+ "#666666",
6753
+ "#4d4d4d",
6754
+ "#333333",
6755
+ // ROW 2 — RED
6756
+ "#ffe8e8",
6757
+ "#ffc4c4",
6758
+ "#ff9e9e",
6759
+ "#ff7878",
6760
+ "#ff5252",
6761
+ "#ff2d2d",
6762
+ "#ff0707",
6763
+ "#d30000",
6764
+ "#a80000",
6765
+ "#7d0000",
6766
+ // ROW 3 — ORANGE
6767
+ "#fff1e0",
6768
+ "#ffd9b3",
6769
+ "#ffc285",
6770
+ "#ffab57",
6771
+ "#ff9429",
6772
+ "#ff7d00",
6773
+ "#e66700",
6774
+ "#cc5500",
6775
+ "#b24400",
6776
+ "#803000",
6777
+ // ROW 4 — YELLOW
6778
+ "#fffbe0",
6779
+ "#fff4b3",
6780
+ "#ffec85",
6781
+ "#ffe457",
6782
+ "#ffdc29",
6783
+ "#ffd400",
6784
+ "#e6be00",
6785
+ "#cca900",
6786
+ "#b39400",
6787
+ "#806e00",
6788
+ // ROW 5 — GREEN
6789
+ "#e7ffe8",
6790
+ "#c4ffc7",
6791
+ "#9effa5",
6792
+ "#78ff83",
6793
+ "#52ff61",
6794
+ "#2dff3f",
6795
+ "#0afc22",
6796
+ "#00d51d",
6797
+ "#00ad18",
6798
+ "#008512",
6799
+ // ROW 6 — BLUE
6800
+ "#e4f2ff",
6801
+ "#bcdcff",
6802
+ "#94c5ff",
6803
+ "#6badff",
6804
+ "#4396ff",
6805
+ "#1b7eff",
6806
+ "#0065e6",
6807
+ "#0054bf",
6808
+ "#004499",
6809
+ "#003373",
6810
+ // ROW 7 — PURPLE
6811
+ "#f3e6ff",
6812
+ "#dfb5ff",
6813
+ "#cb85ff",
6814
+ "#b755ff",
6815
+ "#a326ff",
6816
+ "#8a0dff",
6817
+ "#7600e6",
6818
+ "#6300bf",
6819
+ "#4f0099",
6820
+ "#3c0073"
6821
+ ];
6822
+
6823
+ // src/lib/editorStorage.ts
6824
+ var STORAGE_KEY = "tiptap-tabs-v1";
6825
+ var ACTIVE_TAB_KEY = "tiptap-active-tab";
6826
+ function loadTabs() {
6827
+ if (typeof window === "undefined") return [];
6828
+ try {
6829
+ const raw = localStorage.getItem("tiptap-tabs-v1");
6830
+ if (!raw) return [];
6831
+ const parsed = JSON.parse(raw);
6832
+ if (!Array.isArray(parsed)) return [];
6833
+ return parsed;
6834
+ } catch {
6835
+ return [];
6836
+ }
6837
+ }
6838
+ function saveTabs(tabs) {
6839
+ if (typeof window === "undefined") return;
6840
+ localStorage.setItem(STORAGE_KEY, JSON.stringify(tabs));
6841
+ }
6842
+ function loadActiveTab() {
6843
+ if (typeof window === "undefined") return "1";
6844
+ return localStorage.getItem(ACTIVE_TAB_KEY) ?? "1";
6845
+ }
6846
+ function saveActiveTab(id) {
6847
+ if (typeof window === "undefined") return;
6848
+ localStorage.setItem(ACTIVE_TAB_KEY, id);
6849
+ }
6850
+
6742
6851
  // src/lib/font.ts
6743
6852
  var FONT_OPTIONS = [
6744
- { label: "Inter", cssFontFamily: "Inter" },
6745
- { label: "Roboto", cssFontFamily: "Roboto" },
6746
- { label: "Open Sans", cssFontFamily: "Opensans" },
6747
- { label: "Poppins", cssFontFamily: "Poppins" },
6748
- { label: "Montserrat", cssFontFamily: "Montserrat" },
6749
- { label: "Lato", cssFontFamily: "Lato" },
6750
- { label: "Oswald", cssFontFamily: "Oswald" },
6751
- { label: "Raleway", cssFontFamily: "Raleway" },
6752
- { label: "Merriweather", cssFontFamily: "Merriweather" },
6753
- { label: "Playfair Display", cssFontFamily: "Playfair" },
6754
- { label: "Ubuntu", cssFontFamily: "Ubuntu" },
6755
- { label: "PT Sans", cssFontFamily: "Ptsans" },
6756
- { label: "Barlow", cssFontFamily: "Barlow" },
6757
- { label: "Fira Sans", cssFontFamily: "Fira" },
6758
- { label: "Nunito", cssFontFamily: "Nunito" },
6759
- { label: "Cabin", cssFontFamily: "Cabin" },
6760
- { label: "Bebas Neue", cssFontFamily: "Bebas" },
6761
- { label: "Source Serif Pro", cssFontFamily: "Sourceserif" },
6762
- { label: "Libre Baskerville", cssFontFamily: "Librebask" },
6763
- { label: "Rubik", cssFontFamily: "Rubik" },
6764
- { label: "Inconsolata", cssFontFamily: "Inconsolata" },
6765
- { label: "Work Sans", cssFontFamily: "Worksans" },
6766
- { label: "Mulish", cssFontFamily: "Mulish" },
6767
- { label: "Quicksand", cssFontFamily: "Quicksand" },
6768
- { label: "Kanit", cssFontFamily: "Kanit" },
6769
- { label: "Teko", cssFontFamily: "Teko" },
6770
- { label: "Josefin Sans", cssFontFamily: "Josefin" },
6771
- { label: "Philosopher", cssFontFamily: "Philosopher" },
6772
- { label: "Dancing Script", cssFontFamily: "Dancing" },
6773
- { label: "Noto Serif", cssFontFamily: "Notoserif" },
6774
- { label: "Manrope", cssFontFamily: "Manrope" },
6775
- { label: "Space Grotesk", cssFontFamily: "Spacegrotesk" }
6853
+ { label: "Inter", cssFontFamily: "Inter, sans-serif", googleFontName: "Inter" },
6854
+ { label: "Roboto", cssFontFamily: "Roboto, sans-serif", googleFontName: "Roboto" },
6855
+ { label: "Open Sans", cssFontFamily: "'Open Sans', sans-serif", googleFontName: "Open+Sans" },
6856
+ { label: "Poppins", cssFontFamily: "Poppins, sans-serif", googleFontName: "Poppins" },
6857
+ { label: "Montserrat", cssFontFamily: "Montserrat, sans-serif", googleFontName: "Montserrat" },
6858
+ { label: "Lato", cssFontFamily: "Lato, sans-serif", googleFontName: "Lato" },
6859
+ { label: "Oswald", cssFontFamily: "Oswald, sans-serif", googleFontName: "Oswald" },
6860
+ { label: "Raleway", cssFontFamily: "Raleway, sans-serif", googleFontName: "Raleway" },
6861
+ { label: "Merriweather", cssFontFamily: "Merriweather, serif", googleFontName: "Merriweather" },
6862
+ { label: "Playfair Display", cssFontFamily: "'Playfair Display', serif", googleFontName: "Playfair+Display" },
6863
+ { label: "Ubuntu", cssFontFamily: "Ubuntu, sans-serif", googleFontName: "Ubuntu" },
6864
+ { label: "PT Sans", cssFontFamily: "'PT Sans', sans-serif", googleFontName: "PT+Sans" },
6865
+ { label: "Barlow", cssFontFamily: "Barlow, sans-serif", googleFontName: "Barlow" },
6866
+ { label: "Fira Sans", cssFontFamily: "'Fira Sans', sans-serif", googleFontName: "Fira+Sans" },
6867
+ { label: "Nunito", cssFontFamily: "Nunito, sans-serif", googleFontName: "Nunito" },
6868
+ { label: "Cabin", cssFontFamily: "Cabin, sans-serif", googleFontName: "Cabin" },
6869
+ { label: "Bebas Neue", cssFontFamily: "'Bebas Neue', cursive", googleFontName: "Bebas+Neue" },
6870
+ { label: "Source Serif Pro", cssFontFamily: "'Source Serif Pro', serif", googleFontName: "Source+Serif+Pro" },
6871
+ { label: "Libre Baskerville", cssFontFamily: "'Libre Baskerville', serif", googleFontName: "Libre+Baskerville" },
6872
+ { label: "Rubik", cssFontFamily: "Rubik, sans-serif", googleFontName: "Rubik" },
6873
+ { label: "Inconsolata", cssFontFamily: "Inconsolata, monospace", googleFontName: "Inconsolata" },
6874
+ { label: "Work Sans", cssFontFamily: "'Work Sans', sans-serif", googleFontName: "Work+Sans" },
6875
+ { label: "Mulish", cssFontFamily: "Mulish, sans-serif", googleFontName: "Mulish" },
6876
+ { label: "Quicksand", cssFontFamily: "Quicksand, sans-serif", googleFontName: "Quicksand" },
6877
+ { label: "Kanit", cssFontFamily: "Kanit, sans-serif", googleFontName: "Kanit" },
6878
+ { label: "Teko", cssFontFamily: "Teko, sans-serif", googleFontName: "Teko" },
6879
+ { label: "Josefin Sans", cssFontFamily: "'Josefin Sans', sans-serif", googleFontName: "Josefin+Sans" },
6880
+ { label: "Philosopher", cssFontFamily: "Philosopher, sans-serif", googleFontName: "Philosopher" },
6881
+ { label: "Dancing Script", cssFontFamily: "'Dancing Script', cursive", googleFontName: "Dancing+Script" },
6882
+ { label: "Noto Serif", cssFontFamily: "'Noto Serif', serif", googleFontName: "Noto+Serif" },
6883
+ { label: "Manrope", cssFontFamily: "Manrope, sans-serif", googleFontName: "Manrope" },
6884
+ { label: "Space Grotesk", cssFontFamily: "'Space Grotesk', sans-serif", googleFontName: "Space+Grotesk" }
6776
6885
  ];
6777
6886
 
6887
+ // src/lib/local-image.ts
6888
+ function fileToBase64(file) {
6889
+ return new Promise((resolve, reject) => {
6890
+ const reader = new FileReader();
6891
+ reader.readAsDataURL(file);
6892
+ reader.onload = () => resolve(reader.result);
6893
+ reader.onerror = (error) => reject(error);
6894
+ });
6895
+ }
6896
+ function saveImageBase64(key, base64) {
6897
+ localStorage.setItem(key, base64);
6898
+ }
6899
+ function loadImageBase64(key) {
6900
+ return localStorage.getItem(key);
6901
+ }
6902
+
6903
+ // src/lib/font-loader.ts
6904
+ var fontsLoaded = false;
6905
+ function loadGoogleFonts() {
6906
+ if (fontsLoaded || typeof document === "undefined") return;
6907
+ const fontNames = FONT_OPTIONS.filter((font) => font.googleFontName).map((font) => font.googleFontName);
6908
+ if (fontNames.length === 0) return;
6909
+ const fontFamilies = fontNames.join("&family=");
6910
+ const googleFontsUrl = `https://fonts.googleapis.com/css2?family=${fontFamilies}&display=swap`;
6911
+ const existingLink = document.querySelector(`link[href*="fonts.googleapis.com"]`);
6912
+ if (existingLink) {
6913
+ fontsLoaded = true;
6914
+ return;
6915
+ }
6916
+ const link = document.createElement("link");
6917
+ link.rel = "stylesheet";
6918
+ link.href = googleFontsUrl;
6919
+ document.head.appendChild(link);
6920
+ fontsLoaded = true;
6921
+ }
6922
+
6778
6923
  // src/components/tiptap-ui/font-family-dropdown/font-family-dropdown.tsx
6779
6924
  var import_lucide_react9 = require("lucide-react");
6780
6925
 
@@ -6924,6 +7069,9 @@ var import_jsx_runtime76 = require("react/jsx-runtime");
6924
7069
  function FontFamilyDropdown() {
6925
7070
  const { editor } = (0, import_react85.useCurrentEditor)();
6926
7071
  const [open, setOpen] = (0, import_react86.useState)(false);
7072
+ (0, import_react86.useEffect)(() => {
7073
+ loadGoogleFonts();
7074
+ }, []);
6927
7075
  if (!editor) return null;
6928
7076
  const currentFont = editor.getAttributes("textStyle").fontFamily || "Font Family";
6929
7077
  const applyFont = (family) => {
@@ -6946,7 +7094,7 @@ function FontFamilyDropdown() {
6946
7094
  Button,
6947
7095
  {
6948
7096
  variant: "outlineFontFamily",
6949
- className: "\r\n min-w-[90px] h-7 px-2 flex items-center justify-between rounded-sm\r\n border-[#a3a3a8] text-[#a3a3a8]\r\n hover:border-[#000] hover:text-[#fff] transition-colors\r\n ",
7097
+ 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",
6950
7098
  children: [
6951
7099
  currentFont,
6952
7100
  /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_lucide_react9.ChevronDown, { className: "w-4 h-4" })
@@ -6996,7 +7144,7 @@ function FontFamilyDropdown() {
6996
7144
  CommandItem,
6997
7145
  {
6998
7146
  onSelect: () => {
6999
- applyFont(label);
7147
+ applyFont(cssFontFamily);
7000
7148
  setOpen(false);
7001
7149
  },
7002
7150
  style: { fontFamily: cssFontFamily },
@@ -7016,89 +7164,6 @@ function FontFamilyDropdown() {
7016
7164
  var import_react87 = require("react");
7017
7165
  var import_react88 = require("@tiptap/react");
7018
7166
  var import_react_colorful = require("react-colorful");
7019
-
7020
- // src/lib/colors.ts
7021
- var GRADIENT_ROWS_70 = [
7022
- // ROW 1 — GRAY (Neutral gradient)
7023
- "#ffffff",
7024
- "#f2f2f2",
7025
- "#e6e6e6",
7026
- "#cccccc",
7027
- "#b3b3b3",
7028
- "#999999",
7029
- "#808080",
7030
- "#666666",
7031
- "#4d4d4d",
7032
- "#333333",
7033
- // ROW 2 — RED
7034
- "#ffe8e8",
7035
- "#ffc4c4",
7036
- "#ff9e9e",
7037
- "#ff7878",
7038
- "#ff5252",
7039
- "#ff2d2d",
7040
- "#ff0707",
7041
- "#d30000",
7042
- "#a80000",
7043
- "#7d0000",
7044
- // ROW 3 — ORANGE
7045
- "#fff1e0",
7046
- "#ffd9b3",
7047
- "#ffc285",
7048
- "#ffab57",
7049
- "#ff9429",
7050
- "#ff7d00",
7051
- "#e66700",
7052
- "#cc5500",
7053
- "#b24400",
7054
- "#803000",
7055
- // ROW 4 — YELLOW
7056
- "#fffbe0",
7057
- "#fff4b3",
7058
- "#ffec85",
7059
- "#ffe457",
7060
- "#ffdc29",
7061
- "#ffd400",
7062
- "#e6be00",
7063
- "#cca900",
7064
- "#b39400",
7065
- "#806e00",
7066
- // ROW 5 — GREEN
7067
- "#e7ffe8",
7068
- "#c4ffc7",
7069
- "#9effa5",
7070
- "#78ff83",
7071
- "#52ff61",
7072
- "#2dff3f",
7073
- "#0afc22",
7074
- "#00d51d",
7075
- "#00ad18",
7076
- "#008512",
7077
- // ROW 6 — BLUE
7078
- "#e4f2ff",
7079
- "#bcdcff",
7080
- "#94c5ff",
7081
- "#6badff",
7082
- "#4396ff",
7083
- "#1b7eff",
7084
- "#0065e6",
7085
- "#0054bf",
7086
- "#004499",
7087
- "#003373",
7088
- // ROW 7 — PURPLE
7089
- "#f3e6ff",
7090
- "#dfb5ff",
7091
- "#cb85ff",
7092
- "#b755ff",
7093
- "#a326ff",
7094
- "#8a0dff",
7095
- "#7600e6",
7096
- "#6300bf",
7097
- "#4f0099",
7098
- "#3c0073"
7099
- ];
7100
-
7101
- // src/components/tiptap-ui/color-picker/color-picker.tsx
7102
7167
  var import_lodash = require("lodash");
7103
7168
 
7104
7169
  // src/components/ui/label.tsx
@@ -7857,50 +7922,6 @@ function useScrolling(target, options = {}) {
7857
7922
  }, [target, debounce2, fallbackToDocument, isScrolling]);
7858
7923
  return isScrolling;
7859
7924
  }
7860
-
7861
- // src/lib/editorStorage.ts
7862
- var STORAGE_KEY = "tiptap-tabs-v1";
7863
- var ACTIVE_TAB_KEY = "tiptap-active-tab";
7864
- function loadTabs() {
7865
- if (typeof window === "undefined") return [];
7866
- try {
7867
- const raw = localStorage.getItem("tiptap-tabs-v1");
7868
- if (!raw) return [];
7869
- const parsed = JSON.parse(raw);
7870
- if (!Array.isArray(parsed)) return [];
7871
- return parsed;
7872
- } catch {
7873
- return [];
7874
- }
7875
- }
7876
- function saveTabs(tabs) {
7877
- if (typeof window === "undefined") return;
7878
- localStorage.setItem(STORAGE_KEY, JSON.stringify(tabs));
7879
- }
7880
- function loadActiveTab() {
7881
- if (typeof window === "undefined") return "1";
7882
- return localStorage.getItem(ACTIVE_TAB_KEY) ?? "1";
7883
- }
7884
- function saveActiveTab(id) {
7885
- if (typeof window === "undefined") return;
7886
- localStorage.setItem(ACTIVE_TAB_KEY, id);
7887
- }
7888
-
7889
- // src/lib/local-image.ts
7890
- function fileToBase64(file) {
7891
- return new Promise((resolve, reject) => {
7892
- const reader = new FileReader();
7893
- reader.readAsDataURL(file);
7894
- reader.onload = () => resolve(reader.result);
7895
- reader.onerror = (error) => reject(error);
7896
- });
7897
- }
7898
- function saveImageBase64(key, base64) {
7899
- localStorage.setItem(key, base64);
7900
- }
7901
- function loadImageBase64(key) {
7902
- return localStorage.getItem(key);
7903
- }
7904
7925
  // Annotate the CommonJS export names for ESM import in node:
7905
7926
  0 && (module.exports = {
7906
7927
  Editor,