@overlap/rte 0.1.6 → 0.1.8

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.
@@ -0,0 +1,9 @@
1
+ import { Plugin } from "../types";
2
+ /**
3
+ * Creates an alignment plugin with a dropdown.
4
+ * @param alignments - Which alignments to offer, defaults to all four.
5
+ */
6
+ export declare function createAlignmentPlugin(alignments?: string[]): Plugin;
7
+ /** Pre-built alignment plugin with all four options */
8
+ export declare const alignmentPlugin: Plugin;
9
+ //# sourceMappingURL=alignment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alignment.d.ts","sourceRoot":"","sources":["../../src/plugins/alignment.tsx"],"names":[],"mappings":"AACA,OAAO,EAAa,MAAM,EAAE,MAAM,UAAU,CAAC;AAqE7C;;;GAGG;AACH,wBAAgB,qBAAqB,CACjC,UAAU,GAAE,MAAM,EAA2C,GAC9D,MAAM,CA8CR;AAED,uDAAuD;AACvD,eAAO,MAAM,eAAe,EAAE,MAAgC,CAAC"}
@@ -5,6 +5,10 @@ import { Plugin } from "../types";
5
5
  export declare const boldPlugin: Plugin;
6
6
  export declare const italicPlugin: Plugin;
7
7
  export declare const underlinePlugin: Plugin;
8
+ export declare const strikethroughPlugin: Plugin;
9
+ export declare const subscriptPlugin: Plugin;
10
+ export declare const superscriptPlugin: Plugin;
11
+ export declare const codeInlinePlugin: Plugin;
8
12
  export declare const undoPlugin: Plugin;
9
13
  export declare const redoPlugin: Plugin;
10
14
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugins/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAA0B,MAAM,EAAE,MAAM,UAAU,CAAC;AAO1D;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,MAKxB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,MAK1B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,MAK7B,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,MAKxB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,MAKxB,CAAC;AAEF;;GAEG;AACH,QAAA,MAAM,oBAAoB,EAAE,MAmC3B,CAAC;AAEF;;GAEG;AACH,QAAA,MAAM,qBAAqB,EAAE,MA2C5B,CAAC;AAGF,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,CAAC;AAevD,eAAO,MAAM,cAAc,EAAE,MAAM,EAUlC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugins/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAA0B,MAAM,EAAE,MAAM,UAAU,CAAC;AAO1D;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,MAKxB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,MAK1B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,MAK7B,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,MAKjC,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,MAK7B,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,MAK/B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,MA8D9B,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,MAKxB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,MAKxB,CAAC;AAEF;;GAEG;AACH,QAAA,MAAM,oBAAoB,EAAE,MAmC3B,CAAC;AAEF;;GAEG;AACH,QAAA,MAAM,qBAAqB,EAAE,MA2C5B,CAAC;AAGF,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,CAAC;AAevD,eAAO,MAAM,cAAc,EAAE,MAAM,EAUlC,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { Plugin } from "../types";
2
+ interface AdvancedLinkOptions {
3
+ enablePageRef?: boolean;
4
+ enableTarget?: boolean;
5
+ enableRel?: boolean;
6
+ enableTitle?: boolean;
7
+ enableUrlExtra?: boolean;
8
+ }
9
+ /**
10
+ * Creates an advanced link plugin with a floating dialog.
11
+ * Supports URL, target, rel, title, page reference, and URL extra.
12
+ */
13
+ export declare function createAdvancedLinkPlugin(options?: AdvancedLinkOptions): Plugin;
14
+ /** Pre-built advanced link plugin with target + rel + title enabled */
15
+ export declare const advancedLinkPlugin: Plugin;
16
+ export {};
17
+ //# sourceMappingURL=linkDialog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linkDialog.d.ts","sourceRoot":"","sources":["../../src/plugins/linkDialog.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA0B,MAAM,EAAE,MAAM,UAAU,CAAC;AAe1D,UAAU,mBAAmB;IACzB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B;AAkbD;;;GAGG;AACH,wBAAgB,wBAAwB,CACpC,OAAO,GAAE,mBAAwB,GAClC,MAAM,CAwCR;AAED,uEAAuE;AACvE,eAAO,MAAM,kBAAkB,EAAE,MAAmC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import { Plugin } from "../types";
3
+ export declare const tablePlugin: Plugin;
4
+ export declare const TableContextMenuProvider: React.FC<{
5
+ children: React.ReactNode;
6
+ }>;
7
+ //# sourceMappingURL=table.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../src/plugins/table.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAExE,OAAO,EAA0B,MAAM,EAAE,MAAM,UAAU,CAAC;AAoR1D,eAAO,MAAM,WAAW,EAAE,MAczB,CAAC;AAMF,eAAO,MAAM,wBAAwB,EAAE,KAAK,CAAC,EAAE,CAAC;IAC5C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B,CA6BA,CAAC"}
package/dist/styles.css CHANGED
@@ -726,3 +726,294 @@
726
726
  .rte-spin {
727
727
  animation: spin 0.8s linear infinite;
728
728
  }
729
+
730
+ /* ═══════════════════════════════════════════════════════════════════════
731
+ Table Styles
732
+ ═══════════════════════════════════════════════════════════════════ */
733
+
734
+ .rte-table {
735
+ border-collapse: collapse;
736
+ width: 100%;
737
+ margin: 12px 0;
738
+ font-size: inherit;
739
+ table-layout: auto;
740
+ }
741
+
742
+ .rte-table td,
743
+ .rte-table th {
744
+ border: 1px solid var(--rte-border-color);
745
+ padding: 8px 12px;
746
+ min-width: 40px;
747
+ vertical-align: top;
748
+ line-height: 1.5;
749
+ }
750
+
751
+ .rte-table th {
752
+ background: var(--rte-button-hover-bg);
753
+ font-weight: 600;
754
+ }
755
+
756
+ .rte-table td:focus,
757
+ .rte-table th:focus {
758
+ outline: 2px solid var(--rte-primary-color);
759
+ outline-offset: -2px;
760
+ }
761
+
762
+ /* Table Insert Dialog */
763
+ .rte-table-insert-dialog {
764
+ position: absolute;
765
+ top: 100%;
766
+ left: 0;
767
+ z-index: 1000;
768
+ background: white;
769
+ border: 1px solid var(--rte-border-color);
770
+ border-radius: 8px;
771
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
772
+ padding: 16px;
773
+ min-width: 200px;
774
+ }
775
+
776
+ .rte-table-insert-title {
777
+ font-size: 13px;
778
+ font-weight: 600;
779
+ margin-bottom: 12px;
780
+ color: var(--rte-text-color);
781
+ }
782
+
783
+ .rte-table-insert-fields {
784
+ display: flex;
785
+ gap: 12px;
786
+ margin-bottom: 12px;
787
+ }
788
+
789
+ .rte-table-insert-label {
790
+ display: flex;
791
+ flex-direction: column;
792
+ gap: 4px;
793
+ font-size: 12px;
794
+ color: var(--rte-text-secondary);
795
+ flex: 1;
796
+ }
797
+
798
+ .rte-table-insert-input {
799
+ padding: 6px 8px;
800
+ border: 1px solid var(--rte-border-color);
801
+ border-radius: 4px;
802
+ font-size: 14px;
803
+ width: 100%;
804
+ font-family: var(--rte-font-family);
805
+ outline: none;
806
+ }
807
+
808
+ .rte-table-insert-input:focus {
809
+ border-color: var(--rte-primary-color);
810
+ box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
811
+ }
812
+
813
+ .rte-table-insert-btn {
814
+ width: 100%;
815
+ padding: 8px 12px;
816
+ background: var(--rte-primary-color);
817
+ color: white;
818
+ border: none;
819
+ border-radius: 6px;
820
+ font-size: 13px;
821
+ font-weight: 500;
822
+ cursor: pointer;
823
+ font-family: var(--rte-font-family);
824
+ transition: background 0.15s;
825
+ }
826
+
827
+ .rte-table-insert-btn:hover {
828
+ filter: brightness(0.9);
829
+ }
830
+
831
+ /* Table Context Menu */
832
+ .rte-table-context-menu {
833
+ z-index: 1000;
834
+ background: white;
835
+ border: 1px solid var(--rte-border-color);
836
+ border-radius: 8px;
837
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
838
+ padding: 4px;
839
+ min-width: 180px;
840
+ }
841
+
842
+ .rte-table-context-menu button {
843
+ display: block;
844
+ width: 100%;
845
+ padding: 8px 12px;
846
+ background: none;
847
+ border: none;
848
+ border-radius: 4px;
849
+ font-size: 13px;
850
+ text-align: left;
851
+ cursor: pointer;
852
+ color: var(--rte-text-color);
853
+ font-family: var(--rte-font-family);
854
+ transition: background 0.1s;
855
+ }
856
+
857
+ .rte-table-context-menu button:hover {
858
+ background: var(--rte-button-hover-bg);
859
+ }
860
+
861
+ .rte-table-context-danger {
862
+ color: #dc2626 !important;
863
+ }
864
+
865
+ .rte-table-context-danger:hover {
866
+ background: #fef2f2 !important;
867
+ }
868
+
869
+ .rte-table-context-divider {
870
+ height: 1px;
871
+ background: var(--rte-border-color);
872
+ margin: 4px 0;
873
+ }
874
+
875
+ /* ═══════════════════════════════════════════════════════════════════════
876
+ Link Dialog Styles
877
+ ═══════════════════════════════════════════════════════════════════ */
878
+
879
+ .rte-link-dialog {
880
+ position: absolute;
881
+ top: 100%;
882
+ left: 0;
883
+ z-index: 1000;
884
+ background: white;
885
+ border: 1px solid var(--rte-border-color);
886
+ border-radius: 8px;
887
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
888
+ padding: 16px;
889
+ min-width: 320px;
890
+ max-width: 400px;
891
+ }
892
+
893
+ .rte-link-dialog-title {
894
+ font-size: 13px;
895
+ font-weight: 600;
896
+ margin-bottom: 12px;
897
+ color: var(--rte-text-color);
898
+ }
899
+
900
+ .rte-link-dialog-field {
901
+ margin-bottom: 10px;
902
+ }
903
+
904
+ .rte-link-dialog-label {
905
+ display: block;
906
+ font-size: 12px;
907
+ font-weight: 500;
908
+ color: var(--rte-text-secondary);
909
+ margin-bottom: 4px;
910
+ }
911
+
912
+ .rte-link-dialog-input,
913
+ .rte-link-dialog-select {
914
+ width: 100%;
915
+ padding: 7px 10px;
916
+ border: 1px solid var(--rte-border-color);
917
+ border-radius: 4px;
918
+ font-size: 13px;
919
+ font-family: var(--rte-font-family);
920
+ outline: none;
921
+ background: white;
922
+ color: var(--rte-text-color);
923
+ }
924
+
925
+ .rte-link-dialog-input:focus,
926
+ .rte-link-dialog-select:focus {
927
+ border-color: var(--rte-primary-color);
928
+ box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
929
+ }
930
+
931
+ .rte-link-dialog-toggle {
932
+ background: none;
933
+ border: none;
934
+ padding: 4px 0;
935
+ font-size: 12px;
936
+ color: var(--rte-primary-color);
937
+ cursor: pointer;
938
+ font-family: var(--rte-font-family);
939
+ margin-bottom: 8px;
940
+ }
941
+
942
+ .rte-link-dialog-toggle:hover {
943
+ text-decoration: underline;
944
+ }
945
+
946
+ .rte-link-dialog-advanced {
947
+ border-top: 1px solid var(--rte-border-color);
948
+ padding-top: 10px;
949
+ margin-top: 4px;
950
+ }
951
+
952
+ .rte-link-dialog-actions {
953
+ display: flex;
954
+ gap: 8px;
955
+ margin-top: 14px;
956
+ }
957
+
958
+ .rte-link-dialog-btn {
959
+ padding: 7px 14px;
960
+ border: 1px solid var(--rte-border-color);
961
+ border-radius: 6px;
962
+ font-size: 13px;
963
+ font-weight: 500;
964
+ cursor: pointer;
965
+ font-family: var(--rte-font-family);
966
+ background: white;
967
+ color: var(--rte-text-color);
968
+ transition: all 0.15s;
969
+ }
970
+
971
+ .rte-link-dialog-btn:hover {
972
+ background: var(--rte-button-hover-bg);
973
+ }
974
+
975
+ .rte-link-dialog-btn-primary {
976
+ background: var(--rte-primary-color);
977
+ color: white;
978
+ border-color: var(--rte-primary-color);
979
+ }
980
+
981
+ .rte-link-dialog-btn-primary:hover:not(:disabled) {
982
+ filter: brightness(0.9);
983
+ }
984
+
985
+ .rte-link-dialog-btn-primary:disabled {
986
+ opacity: 0.5;
987
+ cursor: not-allowed;
988
+ }
989
+
990
+ .rte-link-dialog-btn-danger {
991
+ color: #dc2626;
992
+ border-color: #fca5a5;
993
+ }
994
+
995
+ .rte-link-dialog-btn-danger:hover {
996
+ background: #fef2f2;
997
+ }
998
+
999
+ /* ═══════════════════════════════════════════════════════════════════════
1000
+ Inline code, sub, sup styles
1001
+ ═══════════════════════════════════════════════════════════════════ */
1002
+
1003
+ .rte-content code {
1004
+ background: rgba(0, 0, 0, 0.06);
1005
+ padding: 2px 5px;
1006
+ border-radius: 3px;
1007
+ font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
1008
+ font-size: 0.9em;
1009
+ }
1010
+
1011
+ .rte-content sub {
1012
+ font-size: 0.75em;
1013
+ vertical-align: sub;
1014
+ }
1015
+
1016
+ .rte-content sup {
1017
+ font-size: 0.75em;
1018
+ vertical-align: super;
1019
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../src/utils/content.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAc,MAAM,UAAU,CAAC;AAIrD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,WAAW,GAAG,aAAa,CA+QhE;AAED;;GAEG;AACH,wB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,kBAAkB,IAAI,aAAa,CAIlD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAI5D;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,aAAa,CAI/D"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Table DOM manipulation utilities for contentEditable.
3
+ * Pure DOM functions — no React dependency.
4
+ */
5
+ /** Get the <td>/<th> cell that contains the current selection. */
6
+ export declare function getActiveCell(): HTMLTableCellElement | null;
7
+ /** Get the <table> that contains the current selection. */
8
+ export declare function getActiveTable(): HTMLTableElement | null;
9
+ /** Get the <tr> that contains the current selection. */
10
+ export declare function getActiveRow(): HTMLTableRowElement | null;
11
+ /** Place the cursor inside a cell (at the start). */
12
+ export declare function focusCell(cell: HTMLTableCellElement): void;
13
+ /** Create a new table element with the given dimensions. */
14
+ export declare function createTable(rows: number, cols: number, withHeader?: boolean): HTMLTableElement;
15
+ /** Insert a row above or below the currently selected row. */
16
+ export declare function insertRow(position: "above" | "below"): void;
17
+ /** Delete the row that contains the current selection. */
18
+ export declare function deleteRow(): void;
19
+ /** Insert a column to the left or right of the currently selected cell. */
20
+ export declare function insertColumn(position: "left" | "right"): void;
21
+ /** Delete the column that contains the currently selected cell. */
22
+ export declare function deleteColumn(): void;
23
+ /** Remove the entire table and place cursor after it. */
24
+ export declare function deleteTable(): void;
25
+ /**
26
+ * Move focus to the next or previous table cell.
27
+ * Returns true if navigation happened (caller should preventDefault).
28
+ */
29
+ export declare function navigateTableCell(direction: "next" | "prev"): boolean;
30
+ //# sourceMappingURL=table.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../src/utils/table.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,kEAAkE;AAClE,wBAAgB,aAAa,IAAI,oBAAoB,GAAG,IAAI,CAU3D;AAED,2DAA2D;AAC3D,wBAAgB,cAAc,IAAI,gBAAgB,GAAG,IAAI,CAGxD;AAED,wDAAwD;AACxD,wBAAgB,YAAY,IAAI,mBAAmB,GAAG,IAAI,CAGzD;AAED,qDAAqD;AACrD,wBAAgB,SAAS,CAAC,IAAI,EAAE,oBAAoB,GAAG,IAAI,CAgB1D;AAUD,4DAA4D;AAC5D,wBAAgB,WAAW,CACvB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,UAAU,GAAE,OAAe,GAC5B,gBAAgB,CAgClB;AAID,8DAA8D;AAC9D,wBAAgB,SAAS,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,GAAG,IAAI,CAoB3D;AAED,0DAA0D;AAC1D,wBAAgB,SAAS,IAAI,IAAI,CAmBhC;AAID,2EAA2E;AAC3E,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAsB7D;AAED,mEAAmE;AACnE,wBAAgB,YAAY,IAAI,IAAI,CA2BnC;AAID,yDAAyD;AACzD,wBAAgB,WAAW,IAAI,IAAI,CA4BlC;AAID;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAuCrE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@overlap/rte",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "A lightweight, extensible Rich Text Editor for React",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",