@udecode/plate-utils
Advanced tools
Comparing version 34.0.1 to 34.0.2
@@ -12,2 +12,26 @@ import { Location } from 'slate'; | ||
interface InputProps { | ||
/** | ||
* Should we activate the onKeyDownCapture handler to preventDefault when | ||
* the user presses enter? | ||
*/ | ||
preventDefaultOnEnterKeydown?: boolean; | ||
} | ||
/** | ||
* Hook to allow the user to spread a set of predefined props to the Div wrapper | ||
* of an Input element | ||
* | ||
* @param param0 an options object which can be expanded to add further functionality | ||
* @returns a props object which can be spread onto the element | ||
*/ | ||
declare const useFormInputProps: (options?: InputProps) => { | ||
props: { | ||
onKeyDownCapture?: undefined; | ||
}; | ||
} | { | ||
props: { | ||
onKeyDownCapture: ((e: React.KeyboardEvent<HTMLDivElement>) => void) | undefined; | ||
}; | ||
}; | ||
interface SelectEditorOptions { | ||
@@ -58,2 +82,2 @@ /** Specific location if edge is not defined. */ | ||
export { type PlaceholderProps, PlateElementProps, type SelectEditorOptions, selectEditor, useMarkToolbarButton, useMarkToolbarButtonState, usePlaceholderState, useRemoveNodeButton }; | ||
export { type PlaceholderProps, PlateElementProps, type SelectEditorOptions, selectEditor, useFormInputProps, useMarkToolbarButton, useMarkToolbarButtonState, usePlaceholderState, useRemoveNodeButton }; |
@@ -74,2 +74,3 @@ "use strict"; | ||
selectEditor: () => selectEditor, | ||
useFormInputProps: () => useFormInputProps, | ||
useMarkToolbarButton: () => useMarkToolbarButton, | ||
@@ -84,2 +85,19 @@ useMarkToolbarButtonState: () => useMarkToolbarButtonState, | ||
// src/useFormInputProps.ts | ||
var useFormInputProps = (options) => { | ||
if (!options) | ||
return { props: {} }; | ||
const { preventDefaultOnEnterKeydown } = options; | ||
const handleEnterKeydownCapture = (e) => { | ||
if (e.key === "Enter" || e.keyCode === 13) { | ||
e.preventDefault(); | ||
} | ||
}; | ||
return { | ||
props: { | ||
onKeyDownCapture: preventDefaultOnEnterKeydown ? (e) => handleEnterKeydownCapture(e) : void 0 | ||
} | ||
}; | ||
}; | ||
// src/client/selectEditor.ts | ||
@@ -245,2 +263,5 @@ var import_slate = require("@udecode/slate"); | ||
// src/shared/addSelectedRow.ts | ||
var addSelectedRow = (editor, id, options = {}) => editor.addSelectedRow(id, options); | ||
// src/shared/createNodeHOC.tsx | ||
@@ -358,5 +379,2 @@ var import_react3 = __toESM(require("react")); | ||
}; | ||
// src/shared/addSelectedRow.ts | ||
var addSelectedRow = (editor, id, options = {}) => editor.addSelectedRow(id, options); | ||
// Annotate the CommonJS export names for ESM import in node: | ||
@@ -376,2 +394,3 @@ 0 && (module.exports = { | ||
selectEditor, | ||
useFormInputProps, | ||
useMarkToolbarButton, | ||
@@ -378,0 +397,0 @@ useMarkToolbarButtonState, |
import React$1 from 'react'; | ||
import { PlateRenderElementProps, PlateRenderLeafProps, ApplyDeepToNodesOptions, PlateEditor } from '@udecode/plate-core'; | ||
import { PlateRenderElementProps, PlateRenderLeafProps, PlateEditor, ApplyDeepToNodesOptions } from '@udecode/plate-core'; | ||
import { Value, TElement, EElement, TText, EText, TNode } from '@udecode/slate'; | ||
@@ -34,2 +34,7 @@ import { BoxProps, TextProps } from '@udecode/react-utils'; | ||
declare const addSelectedRow: <V extends Value>(editor: PlateEditor<V>, id: string, options?: { | ||
aboveHtmlNode?: HTMLDivElement; | ||
clear?: boolean; | ||
}) => any; | ||
declare const createNodeHOC: <V extends Value, T>(HOC: React$1.FC<T>) => (Component: any, props: T) => (childrenProps: PlateRenderElementProps<V>) => React$1.JSX.Element; | ||
@@ -72,7 +77,2 @@ | ||
declare const addSelectedRow: <V extends Value>(editor: PlateEditor<V>, id: string, options?: { | ||
aboveHtmlNode?: HTMLDivElement; | ||
clear?: boolean; | ||
}) => any; | ||
export { type ClassNames, type CreateHOCOptions, type ErrorHandler, type MoveSelectionByOffsetOptions, type OnError, PlateElement, type PlateElementProps, PlateLeaf, type PlateLeafProps, addSelectedRow, createNodeHOC, createNodesHOC, createNodesWithHOC, defaultsDeepToNodes, isType, moveSelectionByOffset, onKeyDownToggleElement, onKeyDownToggleMark, usePlateElement, usePlateLeaf }; |
@@ -148,2 +148,5 @@ "use strict"; | ||
// src/shared/addSelectedRow.ts | ||
var addSelectedRow = (editor, id, options = {}) => editor.addSelectedRow(id, options); | ||
// src/shared/createNodeHOC.tsx | ||
@@ -261,5 +264,2 @@ var import_react3 = __toESM(require("react")); | ||
}; | ||
// src/shared/addSelectedRow.ts | ||
var addSelectedRow = (editor, id, options = {}) => editor.addSelectedRow(id, options); | ||
// Annotate the CommonJS export names for ESM import in node: | ||
@@ -266,0 +266,0 @@ 0 && (module.exports = { |
{ | ||
"name": "@udecode/plate-utils", | ||
"version": "34.0.1", | ||
"version": "34.0.2", | ||
"description": "Plate utils", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
129095
1362