-
-
Notifications
You must be signed in to change notification settings - Fork 755
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2733 from dimaanj/table-cells-merging-poc-3
[TablePlugin] Table cells merging
- Loading branch information
Showing
49 changed files
with
1,978 additions
and
276 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@udecode/plate-serializer-html': major | ||
--- | ||
|
||
- [Breaking] `serializeHtml`: replaced option `slateProps` by `plateProps`. | ||
- Fix errors when the components were using Plate hooks. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@udecode/plate-table': minor | ||
--- | ||
|
||
- Table plugin has now merging support. To enable it, use option `enableMerging: true` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -118,4 +118,4 @@ export const tableValue: any = ( | |
</hp> | ||
{createSpanningTable()} | ||
</fragment> | ||
); | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 14 additions & 28 deletions
42
packages/serializer-html/src/utils/createElementWithSlate.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,35 @@ | ||
import React, { ComponentClass, FunctionComponent } from 'react'; | ||
import { createTEditor, SlateProps, withTReact } from '@udecode/plate-common'; | ||
import { Slate } from 'slate-react'; | ||
import { Plate, PlateProps } from '@udecode/plate-common'; | ||
|
||
/** | ||
* Create a React element wrapped in a Slate provider. | ||
* By default, it will use an empty editor. | ||
* TODO: allow other providers | ||
* Create a React element wrapped in a Plate provider. | ||
*/ | ||
export const createElementWithSlate = ( | ||
slateProps?: Partial<SlateProps>, | ||
plateProps?: Partial<PlateProps>, | ||
dndWrapper?: string | FunctionComponent | ComponentClass | ||
) => { | ||
const { | ||
editor = withTReact(createTEditor()), | ||
editor, | ||
value = [], | ||
onChange = () => {}, | ||
children, | ||
...props | ||
} = slateProps || {}; | ||
} = plateProps || {}; | ||
|
||
if (dndWrapper) { | ||
return React.createElement( | ||
dndWrapper, | ||
null, | ||
React.createElement( | ||
Slate, | ||
{ | ||
editor, | ||
initialValue: value, | ||
onChange, | ||
...props, | ||
} as any, | ||
children | ||
) | ||
); | ||
} | ||
|
||
return React.createElement( | ||
Slate, | ||
const plate = React.createElement( | ||
Plate, | ||
{ | ||
editor, | ||
initialValue: value, | ||
onChange, | ||
...props, | ||
} as any, | ||
} as PlateProps, | ||
children | ||
); | ||
|
||
if (dndWrapper) { | ||
return React.createElement(dndWrapper, null, plate); | ||
} | ||
|
||
return plate; | ||
}; |
Oops, something went wrong.