@livepreso/react-plugin-textfield 0.0.3 → 0.1.1
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/CHANGELOG.json +24 -0
- package/CHANGELOG.md +15 -1
- package/components/BubbleMenu.js +2 -7
- package/components/Select/Select.module.scss +1 -1
- package/components/table-creator/TableCellThumb.js +25 -0
- package/components/table-creator/TableCellThumb.module.scss +19 -0
- package/components/table-creator/TableCreator.js +44 -0
- package/components/table-creator/TableCreatorCombo.js +18 -0
- package/components/table-creator/TableCreatorCombo.module.scss +19 -0
- package/configs/toolbar-configuration.js +22 -14
- package/package.json +1 -1
package/CHANGELOG.json
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@livepreso/react-plugin-textfield",
|
|
3
3
|
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"version": "0.1.1",
|
|
6
|
+
"tag": "@livepreso/react-plugin-textfield_v0.1.1",
|
|
7
|
+
"date": "Wed, 01 Oct 2025 02:27:21 GMT",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"comment": "Remove TextField component toolbar inset as it is no longer required."
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"version": "0.1.0",
|
|
18
|
+
"tag": "@livepreso/react-plugin-textfield_v0.1.0",
|
|
19
|
+
"date": "Mon, 29 Sep 2025 23:56:57 GMT",
|
|
20
|
+
"comments": {
|
|
21
|
+
"minor": [
|
|
22
|
+
{
|
|
23
|
+
"comment": "size selector dropdown for insert table"
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
},
|
|
4
28
|
{
|
|
5
29
|
"version": "0.0.3",
|
|
6
30
|
"tag": "@livepreso/react-plugin-textfield_v0.0.3",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
# Change Log - @livepreso/react-plugin-textfield
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 01 Oct 2025 02:27:21 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 0.1.1
|
|
6
|
+
Wed, 01 Oct 2025 02:27:21 GMT
|
|
7
|
+
|
|
8
|
+
### Patches
|
|
9
|
+
|
|
10
|
+
- Remove TextField component toolbar inset as it is no longer required.
|
|
11
|
+
|
|
12
|
+
## 0.1.0
|
|
13
|
+
Mon, 29 Sep 2025 23:56:57 GMT
|
|
14
|
+
|
|
15
|
+
### Minor changes
|
|
16
|
+
|
|
17
|
+
- size selector dropdown for insert table
|
|
4
18
|
|
|
5
19
|
## 0.0.3
|
|
6
20
|
Thu, 18 Sep 2025 00:33:25 GMT
|
package/components/BubbleMenu.js
CHANGED
|
@@ -8,7 +8,7 @@ import { Plugin, PluginKey } from "@tiptap/pm/state";
|
|
|
8
8
|
import { OverlayPortal, useTransitions } from "@livepreso/content-react";
|
|
9
9
|
import style from "./BubbleMenu.module.scss";
|
|
10
10
|
import { EDITABLE_OUTER_SELECTOR } from "../constants";
|
|
11
|
-
import {
|
|
11
|
+
import { getTestRect } from "./utils";
|
|
12
12
|
|
|
13
13
|
class UnscaledBubbleMenuView extends BubbleMenuView {
|
|
14
14
|
show() {
|
|
@@ -27,12 +27,7 @@ class UnscaledBubbleMenuView extends BubbleMenuView {
|
|
|
27
27
|
|
|
28
28
|
const div = window.Bridge.UI.overlay;
|
|
29
29
|
const divRect = div.getBoundingClientRect();
|
|
30
|
-
|
|
31
|
-
// Percentage applied to maxWidth keeps toolbars out of the way of left/right slide navigation
|
|
32
|
-
// Calculated based on the current current's raw dimensions, against our standard 120px left/right padding
|
|
33
|
-
const { width: rawWidth } = getContentDimensions();
|
|
34
|
-
const widthPerc = rawWidth ? (rawWidth - 240) / rawWidth : 1;
|
|
35
|
-
this.element.style.maxWidth = `${divRect.width * widthPerc}px`;
|
|
30
|
+
this.element.style.maxWidth = `${divRect.width}px`;
|
|
36
31
|
this.element.style.maxHeight = `${divRect.height}px`;
|
|
37
32
|
|
|
38
33
|
const getBoundingClientRect = () => {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import classNames from "classnames";
|
|
4
|
+
|
|
5
|
+
import style from "./TableCellThumb.module.scss";
|
|
6
|
+
|
|
7
|
+
export function TableCellThumb({
|
|
8
|
+
className,
|
|
9
|
+
selected,
|
|
10
|
+
onClick,
|
|
11
|
+
onMouseOver,
|
|
12
|
+
row,
|
|
13
|
+
col,
|
|
14
|
+
}) {
|
|
15
|
+
return (
|
|
16
|
+
<button
|
|
17
|
+
aria-label={`Insert ${col} by ${row} cell table`}
|
|
18
|
+
className={classNames(style.cell, className, {
|
|
19
|
+
[style.selected]: selected,
|
|
20
|
+
})}
|
|
21
|
+
onClick={onClick}
|
|
22
|
+
onMouseOver={onMouseOver}
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
:global(.sp-presenter-overlay) {
|
|
2
|
+
.cell {
|
|
3
|
+
//top level styles
|
|
4
|
+
width: 20px;
|
|
5
|
+
height: 16px;
|
|
6
|
+
margin-bottom: 4px;
|
|
7
|
+
border: 1px solid var(--sp-toolbar-highlight-color);
|
|
8
|
+
|
|
9
|
+
&:not(:last-child) {
|
|
10
|
+
margin-right: 4px;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.selected {
|
|
15
|
+
border: 1px solid var(--sp-toolbar-focus-color);
|
|
16
|
+
background-color: var(--sp-toolbar-hover-color);
|
|
17
|
+
box-shadow: 0 0 1px 1px var(--sp-toolbar-hover-color);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import style from "./TableCreatorCombo.module.scss";
|
|
4
|
+
import { TableCellThumb } from "./TableCellThumb";
|
|
5
|
+
|
|
6
|
+
export function TableCreator({ className, onChange = () => {} }) {
|
|
7
|
+
function handleChange(row, cols) {
|
|
8
|
+
onChange(row, cols);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const [selectedRow, setSelectedRow] = React.useState(0);
|
|
12
|
+
const [selectedCol, setSelectedCol] = React.useState(0);
|
|
13
|
+
|
|
14
|
+
const maxRows = 8;
|
|
15
|
+
const maxCols = 8;
|
|
16
|
+
const rows = Array.from({ length: maxRows }, (_, idx) => idx + 1);
|
|
17
|
+
const cols = Array.from({ length: maxCols }, (_, idx) => idx + 1);
|
|
18
|
+
function handleRollover(rowIndex, colIndex) {
|
|
19
|
+
setSelectedRow(rowIndex);
|
|
20
|
+
setSelectedCol(colIndex);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<div className={style.options}>
|
|
25
|
+
{rows.map((rowIndex) => (
|
|
26
|
+
<div key={`row_${rowIndex}`} className={style.row}>
|
|
27
|
+
{cols.map((colIndex) => (
|
|
28
|
+
<TableCellThumb
|
|
29
|
+
key={`${rowIndex}_${colIndex}`}
|
|
30
|
+
row={rowIndex}
|
|
31
|
+
col={colIndex}
|
|
32
|
+
selected={rowIndex <= selectedRow && colIndex <= selectedCol}
|
|
33
|
+
onClick={() => handleChange(rowIndex, colIndex)}
|
|
34
|
+
onMouseOver={() => handleRollover(rowIndex, colIndex)}
|
|
35
|
+
/>
|
|
36
|
+
))}
|
|
37
|
+
</div>
|
|
38
|
+
))}
|
|
39
|
+
<div className={style.indicator}>
|
|
40
|
+
{!!selectedRow && !!selectedCol && `${selectedCol} x ${selectedRow}`}
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import { TableCreator } from "./TableCreator";
|
|
4
|
+
import { Popover } from "../Popover";
|
|
5
|
+
import toolbarStyle from "../editor-toolbars/EditorToolbar.module.scss";
|
|
6
|
+
import { BorderAll } from "../../icons";
|
|
7
|
+
import { ToolbarButton } from "../editor-toolbars/ToolbarButton";
|
|
8
|
+
|
|
9
|
+
export function TableCreatorCombo({ disabled, onChange }) {
|
|
10
|
+
return (
|
|
11
|
+
<Popover
|
|
12
|
+
triggerClassName={toolbarStyle.item}
|
|
13
|
+
trigger={<ToolbarButton disabled={disabled} icon={<BorderAll />} />}
|
|
14
|
+
>
|
|
15
|
+
<TableCreator onChange={onChange} />
|
|
16
|
+
</Popover>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
@import "../style.module.scss";
|
|
2
|
+
|
|
3
|
+
:global(.sp-presenter-overlay) {
|
|
4
|
+
.indicator {
|
|
5
|
+
font-size: 14px;
|
|
6
|
+
line-height: 16px;
|
|
7
|
+
text-align: center;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.options {
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
padding: 5px;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.row {
|
|
17
|
+
display: flex;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -22,6 +22,7 @@ import { PRIMARY_TOOLBAR_IDS, TOOLBAR_COMPONENT_TYPES } from "../constants";
|
|
|
22
22
|
import LinkEditDialog from "../components/LinkEditDialog";
|
|
23
23
|
import { Gapcursor } from "@tiptap/extensions";
|
|
24
24
|
import { ColorPickerCombo } from "../components/color-picker/ColorPickerCombo";
|
|
25
|
+
import { TableCreatorCombo } from "../components/table-creator/TableCreatorCombo";
|
|
25
26
|
|
|
26
27
|
function generateTextStyleTest(textStyles) {
|
|
27
28
|
return (editor) => {
|
|
@@ -293,21 +294,28 @@ const clearFormattingButton = () => ({
|
|
|
293
294
|
|
|
294
295
|
const insertTableButton = () => ({
|
|
295
296
|
id: PRIMARY_TOOLBAR_IDS.INSERT_TABLE,
|
|
296
|
-
label: "Insert
|
|
297
|
-
type: TOOLBAR_COMPONENT_TYPES.
|
|
297
|
+
label: "Insert table",
|
|
298
|
+
type: TOOLBAR_COMPONENT_TYPES.CUSTOM,
|
|
298
299
|
extensions: [TableExtended, TableCell, TableHeader, TableRow, Gapcursor],
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
300
|
+
renderContent: ({ editor, isEnabled } = {}) => {
|
|
301
|
+
return (
|
|
302
|
+
<TableCreatorCombo
|
|
303
|
+
disabled={!isEnabled}
|
|
304
|
+
onChange={(rows, cols) => {
|
|
305
|
+
editor
|
|
306
|
+
.chain()
|
|
307
|
+
.focus()
|
|
308
|
+
.insertTable({
|
|
309
|
+
rows,
|
|
310
|
+
cols,
|
|
311
|
+
withHeaderRow: true,
|
|
312
|
+
})
|
|
313
|
+
.setFullWidth()
|
|
314
|
+
.run();
|
|
315
|
+
}}
|
|
316
|
+
/>
|
|
317
|
+
);
|
|
318
|
+
},
|
|
311
319
|
});
|
|
312
320
|
|
|
313
321
|
export const primaryItemGenerators = {
|