@openleaf-editor/plugins-table 0.1.0-beta.0
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/LICENSE +202 -0
- package/dist/icons.d.ts +9 -0
- package/dist/icons.d.ts.map +1 -0
- package/dist/icons.js +21 -0
- package/dist/icons.js.map +1 -0
- package/dist/index.d.ts +66 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +225 -0
- package/dist/index.js.map +1 -0
- package/package.json +43 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/dist/icons.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Table icons, registered by the plugin rather than shipped in core.
|
|
3
|
+
*
|
|
4
|
+
* Eleven icons is about a kilobyte, and a deployment with tables switched off has
|
|
5
|
+
* no reason to download it. Same 24x24 stroked geometry as the built-in set so
|
|
6
|
+
* they sit level with the rest of the toolbar.
|
|
7
|
+
*/
|
|
8
|
+
export declare const TABLE_ICON_PATHS: Record<string, string>;
|
|
9
|
+
//# sourceMappingURL=icons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../src/icons.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAYnD,CAAA"}
|
package/dist/icons.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Table icons, registered by the plugin rather than shipped in core.
|
|
3
|
+
*
|
|
4
|
+
* Eleven icons is about a kilobyte, and a deployment with tables switched off has
|
|
5
|
+
* no reason to download it. Same 24x24 stroked geometry as the built-in set so
|
|
6
|
+
* they sit level with the rest of the toolbar.
|
|
7
|
+
*/
|
|
8
|
+
export const TABLE_ICON_PATHS = {
|
|
9
|
+
table: 'M3 4h18v16H3zM3 10h18M3 15h18M9 4v16M15 4v16',
|
|
10
|
+
rowBefore: 'M3 14h18v6H3zM12 3v7M9 6l3-3 3 3',
|
|
11
|
+
rowAfter: 'M3 4h18v6H3zM12 21v-7M9 18l3 3 3-3',
|
|
12
|
+
rowDelete: 'M3 9h18v6H3zM8 4l8 16M16 4L8 20',
|
|
13
|
+
columnBefore: 'M14 3v18h6V3zM3 12h7M6 9l-3 3 3 3',
|
|
14
|
+
columnAfter: 'M4 3v18h6V3zM21 12h-7M18 9l3 3-3 3',
|
|
15
|
+
columnDelete: 'M9 3h6v18H9zM4 8l16 8M20 8L4 16',
|
|
16
|
+
mergeCells: 'M3 5h18v14H3zM12 5v3M12 16v3M8 12h8M10 10l-2 2 2 2M14 10l2 2-2 2',
|
|
17
|
+
splitCell: 'M3 5h18v14H3zM12 5v14M9 9l-2 3 2 3M15 9l2 3-2 3',
|
|
18
|
+
headerRow: 'M3 4h18v5H3zM3 9v11h18V9M3 14h18M9 9v11M15 9v11',
|
|
19
|
+
tableDelete: 'M3 4h18v16H3zM3 10h18M9 4v16M8 14l8-8M16 14l-8-8',
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=icons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.js","sourceRoot":"","sources":["../src/icons.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAA2B;IACtD,KAAK,EAAE,8CAA8C;IACrD,SAAS,EAAE,kCAAkC;IAC7C,QAAQ,EAAE,oCAAoC;IAC9C,SAAS,EAAE,iCAAiC;IAC5C,YAAY,EAAE,mCAAmC;IACjD,WAAW,EAAE,oCAAoC;IACjD,YAAY,EAAE,iCAAiC;IAC/C,UAAU,EAAE,kEAAkE;IAC9E,SAAS,EAAE,iDAAiD;IAC5D,SAAS,EAAE,iDAAiD;IAC5D,WAAW,EAAE,kDAAkD;CAChE,CAAA"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Opt-in table editing.
|
|
3
|
+
*
|
|
4
|
+
* ## What is and is not in this package
|
|
5
|
+
*
|
|
6
|
+
* The table *schema* is not here -- it lives in `@openleaf-editor/core` and ships in
|
|
7
|
+
* every deployment. That split is deliberate and the fidelity harness is what
|
|
8
|
+
* forced it: without table node types in the base schema, a `<table>` in stored
|
|
9
|
+
* content is claimed by the preservation layer and becomes an opaque atom.
|
|
10
|
+
* Faithful, but uneditable. "We read your tables but you may not touch them" is
|
|
11
|
+
* not something you can tell a CMS.
|
|
12
|
+
*
|
|
13
|
+
* So everyone gets tables that read and write correctly, for about a kilobyte.
|
|
14
|
+
* What is opt-in is the weight: cell selection, column resizing, the row and
|
|
15
|
+
* column commands, and the toolbar controls -- 12.5 KB gzipped that a site
|
|
16
|
+
* forbidding tables has no reason to download.
|
|
17
|
+
*
|
|
18
|
+
* ## Loading it
|
|
19
|
+
*
|
|
20
|
+
* As a second script tag, after the core bundle:
|
|
21
|
+
*
|
|
22
|
+
* ```html
|
|
23
|
+
* <script src="/js/openleaf.min.js"></script>
|
|
24
|
+
* <script src="/js/openleaf-tables.min.js"></script>
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* The second bundle shares the first one's ProseMirror runtime rather than
|
|
28
|
+
* carrying its own copy, which is what keeps it 12.5 KB instead of ~200 KB.
|
|
29
|
+
*
|
|
30
|
+
* Or as a module:
|
|
31
|
+
*
|
|
32
|
+
* ```ts
|
|
33
|
+
* import { installTableEditing } from '@openleaf-editor/plugins-table'
|
|
34
|
+
* installTableEditing()
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
import type { Command, EditorState } from 'prosemirror-state';
|
|
38
|
+
export declare const TABLE_TOOLBAR_ITEMS: readonly ["insertTable", "addRowBefore", "addRowAfter", "deleteRow", "addColumnBefore", "addColumnAfter", "deleteColumn", "mergeCells", "splitCell", "toggleHeaderRow", "deleteTable"];
|
|
39
|
+
/** A layout string for the default toolbar plus the table controls. */
|
|
40
|
+
export declare const TABLE_LAYOUT_SUFFIX: string;
|
|
41
|
+
/** Is the selection inside a table? Table commands are useless outside one. */
|
|
42
|
+
export declare function inTable(state: EditorState): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Insert a table with a header row.
|
|
45
|
+
*
|
|
46
|
+
* A header row by default rather than a plain grid: a table without headers is
|
|
47
|
+
* an accessibility problem that authors rarely go back and fix, and defaults
|
|
48
|
+
* decide what most documents look like.
|
|
49
|
+
*/
|
|
50
|
+
export declare function insertTable(rows?: number, cols?: number): Command;
|
|
51
|
+
export declare const addColumnAfter: Command;
|
|
52
|
+
export declare const addColumnBefore: Command;
|
|
53
|
+
export declare const addRowAfter: Command;
|
|
54
|
+
export declare const addRowBefore: Command;
|
|
55
|
+
export declare const toggleHeaderRow: Command;
|
|
56
|
+
/** The ProseMirror plugins table editing needs. */
|
|
57
|
+
export declare function tableEditingPlugins(): import("prosemirror-state").Plugin<any>[];
|
|
58
|
+
/**
|
|
59
|
+
* Install table editing: register the plugins and the toolbar controls.
|
|
60
|
+
*
|
|
61
|
+
* Idempotent, because a bundle loaded twice -- which happens in CMS templates
|
|
62
|
+
* more often than anyone would like -- should not produce two sets of buttons.
|
|
63
|
+
*/
|
|
64
|
+
export declare function installTableEditing(): void;
|
|
65
|
+
export { deleteColumn, deleteRow, deleteTable, mergeCells, splitCell, } from 'prosemirror-tables';
|
|
66
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAKH,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAe,MAAM,mBAAmB,CAAA;AAgB1E,eAAO,MAAM,mBAAmB,wLAYtB,CAAA;AAEV,uEAAuE;AACvE,eAAO,MAAM,mBAAmB,QAAwC,CAAA;AAExE,+EAA+E;AAC/E,wBAAgB,OAAO,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAEnD;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,IAAI,SAAI,EAAE,IAAI,SAAI,GAAG,OAAO,CA6BvD;AAmED,eAAO,MAAM,cAAc,SAAmC,CAAA;AAC9D,eAAO,MAAM,eAAe,SAAoC,CAAA;AAChE,eAAO,MAAM,WAAW,SAAgC,CAAA;AACxD,eAAO,MAAM,YAAY,SAAiC,CAAA;AAC1D,eAAO,MAAM,eAAe,SAAoC,CAAA;AAEhE,mDAAmD;AACnD,wBAAgB,mBAAmB,8CAOlC;AAID;;;;;GAKG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAwD1C;AAED,OAAO,EACL,YAAY,EACZ,SAAS,EACT,WAAW,EACX,UAAU,EACV,SAAS,GACV,MAAM,oBAAoB,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Opt-in table editing.
|
|
3
|
+
*
|
|
4
|
+
* ## What is and is not in this package
|
|
5
|
+
*
|
|
6
|
+
* The table *schema* is not here -- it lives in `@openleaf-editor/core` and ships in
|
|
7
|
+
* every deployment. That split is deliberate and the fidelity harness is what
|
|
8
|
+
* forced it: without table node types in the base schema, a `<table>` in stored
|
|
9
|
+
* content is claimed by the preservation layer and becomes an opaque atom.
|
|
10
|
+
* Faithful, but uneditable. "We read your tables but you may not touch them" is
|
|
11
|
+
* not something you can tell a CMS.
|
|
12
|
+
*
|
|
13
|
+
* So everyone gets tables that read and write correctly, for about a kilobyte.
|
|
14
|
+
* What is opt-in is the weight: cell selection, column resizing, the row and
|
|
15
|
+
* column commands, and the toolbar controls -- 12.5 KB gzipped that a site
|
|
16
|
+
* forbidding tables has no reason to download.
|
|
17
|
+
*
|
|
18
|
+
* ## Loading it
|
|
19
|
+
*
|
|
20
|
+
* As a second script tag, after the core bundle:
|
|
21
|
+
*
|
|
22
|
+
* ```html
|
|
23
|
+
* <script src="/js/openleaf.min.js"></script>
|
|
24
|
+
* <script src="/js/openleaf-tables.min.js"></script>
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* The second bundle shares the first one's ProseMirror runtime rather than
|
|
28
|
+
* carrying its own copy, which is what keeps it 12.5 KB instead of ~200 KB.
|
|
29
|
+
*
|
|
30
|
+
* Or as a module:
|
|
31
|
+
*
|
|
32
|
+
* ```ts
|
|
33
|
+
* import { installTableEditing } from '@openleaf-editor/plugins-table'
|
|
34
|
+
* installTableEditing()
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
import { canInsert, isNodeActive, registerEditorPlugin } from '@openleaf-editor/core';
|
|
38
|
+
import { registerIcons, registerToolbarItem } from '@openleaf-editor/ui';
|
|
39
|
+
import { TABLE_ICON_PATHS } from './icons.js';
|
|
40
|
+
import { addColumnAfter as addColumnAfterRaw, addColumnBefore as addColumnBeforeRaw, addRowAfter as addRowAfterRaw, addRowBefore as addRowBeforeRaw, columnResizing, deleteColumn, deleteRow, deleteTable, mergeCells, splitCell, tableEditing, toggleHeaderRow as toggleHeaderRowRaw, } from 'prosemirror-tables';
|
|
41
|
+
export const TABLE_TOOLBAR_ITEMS = [
|
|
42
|
+
'insertTable',
|
|
43
|
+
'addRowBefore',
|
|
44
|
+
'addRowAfter',
|
|
45
|
+
'deleteRow',
|
|
46
|
+
'addColumnBefore',
|
|
47
|
+
'addColumnAfter',
|
|
48
|
+
'deleteColumn',
|
|
49
|
+
'mergeCells',
|
|
50
|
+
'splitCell',
|
|
51
|
+
'toggleHeaderRow',
|
|
52
|
+
'deleteTable',
|
|
53
|
+
];
|
|
54
|
+
/** A layout string for the default toolbar plus the table controls. */
|
|
55
|
+
export const TABLE_LAYOUT_SUFFIX = ` | ${TABLE_TOOLBAR_ITEMS.join(' ')}`;
|
|
56
|
+
/** Is the selection inside a table? Table commands are useless outside one. */
|
|
57
|
+
export function inTable(state) {
|
|
58
|
+
return isNodeActive(state, 'table');
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Insert a table with a header row.
|
|
62
|
+
*
|
|
63
|
+
* A header row by default rather than a plain grid: a table without headers is
|
|
64
|
+
* an accessibility problem that authors rarely go back and fix, and defaults
|
|
65
|
+
* decide what most documents look like.
|
|
66
|
+
*/
|
|
67
|
+
export function insertTable(rows = 3, cols = 3) {
|
|
68
|
+
return (state, dispatch) => {
|
|
69
|
+
if (!canInsert(state, 'table'))
|
|
70
|
+
return false;
|
|
71
|
+
if (dispatch) {
|
|
72
|
+
// From the state's schema, not an imported singleton: a plugin that
|
|
73
|
+
// captured one schema would build nodes the editor's schema rejects.
|
|
74
|
+
const cell = state.schema.nodes['table_cell'];
|
|
75
|
+
const header = state.schema.nodes['table_header'];
|
|
76
|
+
const row = state.schema.nodes['table_row'];
|
|
77
|
+
const tableType = state.schema.nodes['table'];
|
|
78
|
+
if (!cell || !header || !row || !tableType)
|
|
79
|
+
return false;
|
|
80
|
+
const headerCells = Array.from({ length: cols }, () => header.createAndFill({ scope: 'col' })).filter((n) => n !== null);
|
|
81
|
+
const bodyRows = Array.from({ length: Math.max(0, rows - 1) }, () => row.create(null, Array.from({ length: cols }, () => cell.createAndFill()).filter((n) => n !== null)));
|
|
82
|
+
const table = tableType.create(null, [row.create(null, headerCells), ...bodyRows]);
|
|
83
|
+
dispatch(state.tr.replaceSelectionWith(table).scrollIntoView());
|
|
84
|
+
}
|
|
85
|
+
return true;
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Keep `scope` valid when cells change role.
|
|
90
|
+
*
|
|
91
|
+
* `td` and `th` share an attribute set, so the upstream toggle copies `scope`
|
|
92
|
+
* onto a body cell (invalid HTML) and creates header cells without it.
|
|
93
|
+
* Inserting a table already writes `scope="col"`; toggling and adding columns
|
|
94
|
+
* should not undo that.
|
|
95
|
+
*/
|
|
96
|
+
function applyCellScope(tr) {
|
|
97
|
+
const header = tr.doc.type.schema.nodes['table_header'];
|
|
98
|
+
const cell = tr.doc.type.schema.nodes['table_cell'];
|
|
99
|
+
if (!header || !cell)
|
|
100
|
+
return tr;
|
|
101
|
+
let tablePos = -1;
|
|
102
|
+
for (let depth = tr.selection.$from.depth; depth > 0; depth -= 1) {
|
|
103
|
+
if (tr.selection.$from.node(depth).type.spec['tableRole'] === 'table') {
|
|
104
|
+
tablePos = tr.selection.$from.before(depth);
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (tablePos < 0)
|
|
109
|
+
return tr;
|
|
110
|
+
const table = tr.doc.nodeAt(tablePos);
|
|
111
|
+
if (!table)
|
|
112
|
+
return tr;
|
|
113
|
+
// Walked by row and column rather than as a flat descendant list, because a
|
|
114
|
+
// header's scope depends on where it sits. `setNodeMarkup` only changes
|
|
115
|
+
// attributes, so every node keeps its size and these positions stay valid.
|
|
116
|
+
table.forEach((row, rowOffset, rowIndex) => {
|
|
117
|
+
const rowPos = tablePos + 1 + rowOffset;
|
|
118
|
+
row.forEach((cellNode, cellOffset, cellIndex) => {
|
|
119
|
+
const pos = rowPos + 1 + cellOffset;
|
|
120
|
+
if (cellNode.type === cell && cellNode.attrs['scope']) {
|
|
121
|
+
tr.setNodeMarkup(pos, undefined, { ...cellNode.attrs, scope: null });
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
if (cellNode.type !== header)
|
|
125
|
+
return;
|
|
126
|
+
const scope = cellNode.attrs['scope'];
|
|
127
|
+
if (scope !== null && scope !== undefined && scope !== '')
|
|
128
|
+
return;
|
|
129
|
+
// A header in the top row labels a column. A header that opens a later
|
|
130
|
+
// row labels that row -- writing "col" there tells a screen reader the
|
|
131
|
+
// opposite of the truth, which is worse than the missing scope this
|
|
132
|
+
// replaces.
|
|
133
|
+
tr.setNodeMarkup(pos, undefined, {
|
|
134
|
+
...cellNode.attrs,
|
|
135
|
+
scope: rowIndex === 0 || cellIndex > 0 ? 'col' : 'row',
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
return tr;
|
|
140
|
+
}
|
|
141
|
+
function withCellScope(command) {
|
|
142
|
+
return (state, dispatch, view) => {
|
|
143
|
+
if (!dispatch)
|
|
144
|
+
return command(state, undefined, view);
|
|
145
|
+
return command(state, (tr) => {
|
|
146
|
+
dispatch(applyCellScope(tr));
|
|
147
|
+
}, view);
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
export const addColumnAfter = withCellScope(addColumnAfterRaw);
|
|
151
|
+
export const addColumnBefore = withCellScope(addColumnBeforeRaw);
|
|
152
|
+
export const addRowAfter = withCellScope(addRowAfterRaw);
|
|
153
|
+
export const addRowBefore = withCellScope(addRowBeforeRaw);
|
|
154
|
+
export const toggleHeaderRow = withCellScope(toggleHeaderRowRaw);
|
|
155
|
+
/** The ProseMirror plugins table editing needs. */
|
|
156
|
+
export function tableEditingPlugins() {
|
|
157
|
+
return [
|
|
158
|
+
// Resizing must come first: it reads cell geometry that tableEditing's
|
|
159
|
+
// selection handling would otherwise have already consumed.
|
|
160
|
+
columnResizing(),
|
|
161
|
+
tableEditing({ allowTableNodeSelection: true }),
|
|
162
|
+
];
|
|
163
|
+
}
|
|
164
|
+
let installed = false;
|
|
165
|
+
/**
|
|
166
|
+
* Install table editing: register the plugins and the toolbar controls.
|
|
167
|
+
*
|
|
168
|
+
* Idempotent, because a bundle loaded twice -- which happens in CMS templates
|
|
169
|
+
* more often than anyone would like -- should not produce two sets of buttons.
|
|
170
|
+
*/
|
|
171
|
+
export function installTableEditing() {
|
|
172
|
+
if (installed)
|
|
173
|
+
return;
|
|
174
|
+
installed = true;
|
|
175
|
+
registerIcons(TABLE_ICON_PATHS);
|
|
176
|
+
registerEditorPlugin(() => tableEditingPlugins());
|
|
177
|
+
registerToolbarItem({
|
|
178
|
+
id: 'insertTable',
|
|
179
|
+
type: 'button',
|
|
180
|
+
kind: 'action',
|
|
181
|
+
label: 'Insert table',
|
|
182
|
+
icon: 'table',
|
|
183
|
+
command: insertTable(),
|
|
184
|
+
});
|
|
185
|
+
const commands = [
|
|
186
|
+
['addRowBefore', 'Insert row above', addRowBefore],
|
|
187
|
+
['addRowAfter', 'Insert row below', addRowAfter],
|
|
188
|
+
['deleteRow', 'Delete row', deleteRow],
|
|
189
|
+
['addColumnBefore', 'Insert column before', addColumnBefore],
|
|
190
|
+
['addColumnAfter', 'Insert column after', addColumnAfter],
|
|
191
|
+
['deleteColumn', 'Delete column', deleteColumn],
|
|
192
|
+
['mergeCells', 'Merge cells', mergeCells],
|
|
193
|
+
['splitCell', 'Split cell', splitCell],
|
|
194
|
+
['toggleHeaderRow', 'Toggle header row', toggleHeaderRow],
|
|
195
|
+
['deleteTable', 'Delete table', deleteTable],
|
|
196
|
+
];
|
|
197
|
+
const icons = {
|
|
198
|
+
addRowBefore: 'rowBefore',
|
|
199
|
+
addRowAfter: 'rowAfter',
|
|
200
|
+
deleteRow: 'rowDelete',
|
|
201
|
+
addColumnBefore: 'columnBefore',
|
|
202
|
+
addColumnAfter: 'columnAfter',
|
|
203
|
+
deleteColumn: 'columnDelete',
|
|
204
|
+
mergeCells: 'mergeCells',
|
|
205
|
+
splitCell: 'splitCell',
|
|
206
|
+
toggleHeaderRow: 'headerRow',
|
|
207
|
+
deleteTable: 'tableDelete',
|
|
208
|
+
};
|
|
209
|
+
for (const [id, label, command] of commands) {
|
|
210
|
+
registerToolbarItem({
|
|
211
|
+
id,
|
|
212
|
+
type: 'button',
|
|
213
|
+
kind: 'action',
|
|
214
|
+
label,
|
|
215
|
+
...(icons[id] ? { icon: icons[id] } : {}),
|
|
216
|
+
command,
|
|
217
|
+
// Every one of these is meaningless outside a table. Reporting them as
|
|
218
|
+
// disabled rather than letting them silently no-op is the difference
|
|
219
|
+
// between a control that looks broken and one that looks unavailable.
|
|
220
|
+
isEnabled: (state) => inTable(state) && command(state),
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
export { deleteColumn, deleteRow, deleteTable, mergeCells, splitCell, } from 'prosemirror-tables';
|
|
225
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AACrF,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAE7C,OAAO,EACL,cAAc,IAAI,iBAAiB,EACnC,eAAe,IAAI,kBAAkB,EACrC,WAAW,IAAI,cAAc,EAC7B,YAAY,IAAI,eAAe,EAC/B,cAAc,EACd,YAAY,EACZ,SAAS,EACT,WAAW,EACX,UAAU,EACV,SAAS,EACT,YAAY,EACZ,eAAe,IAAI,kBAAkB,GACtC,MAAM,oBAAoB,CAAA;AAE3B,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,aAAa;IACb,cAAc;IACd,aAAa;IACb,WAAW;IACX,iBAAiB;IACjB,gBAAgB;IAChB,cAAc;IACd,YAAY;IACZ,WAAW;IACX,iBAAiB;IACjB,aAAa;CACL,CAAA;AAEV,uEAAuE;AACvE,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAA;AAExE,+E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,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACzC,OAAO;YACP,uEAAuE;YACvE,qEAAqE;YACrE,sEAAsE;YACtE,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,KAAK,CAAC;SACvD,CAAC,CAAA;IACJ,CAAC;AACH,CAAC;AAED,OAAO,EACL,YAAY,EACZ,SAAS,EACT,WAAW,EACX,UAAU,EACV,SAAS,GACV,MAAM,oBAAoB,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@openleaf-editor/plugins-table",
|
|
3
|
+
"version": "0.1.0-beta.0",
|
|
4
|
+
"description": "Opt-in table editing for OpenLeaf: cell selection, column resizing, row and column commands, and toolbar controls. The table schema itself lives in @openleaf-editor/core so every deployment reads tables faithfully.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/PeytonNowlin/openleaf.git",
|
|
12
|
+
"directory": "packages/plugins-table"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://peytonnowlin.github.io/openleaf/",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/PeytonNowlin/openleaf/issues"
|
|
17
|
+
},
|
|
18
|
+
"type": "module",
|
|
19
|
+
"main": "./dist/index.js",
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"import": "./dist/index.js"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist"
|
|
29
|
+
],
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"prosemirror-keymap": "^1.2.2",
|
|
32
|
+
"prosemirror-model": "^1.24.1",
|
|
33
|
+
"prosemirror-state": "^1.4.3",
|
|
34
|
+
"prosemirror-tables": "^1.6.4",
|
|
35
|
+
"prosemirror-transform": "^1.10.2",
|
|
36
|
+
"prosemirror-view": "^1.37.0",
|
|
37
|
+
"@openleaf-editor/core": "0.1.0-beta.0",
|
|
38
|
+
"@openleaf-editor/ui": "0.1.0-beta.0"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "tsc -p tsconfig.json"
|
|
42
|
+
}
|
|
43
|
+
}
|