@arkyn/components 1.3.115 → 1.3.116
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/bundle.js +1729 -1745
- package/dist/bundle.umd.cjs +28 -28
- package/dist/components/RichText/index.d.ts.map +1 -1
- package/dist/components/RichText/index.js +1 -12
- package/package.json +1 -1
- package/src/components/RichText/index.tsx +9 -13
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/RichText/index.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAgB,UAAU,EAAoB,MAAM,OAAO,CAAC;AAanE,OAAO,cAAc,CAAC;AAGtB,KAAK,aAAa,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,IAAI,CAAC;IACzC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC,CAAC;AAEF,iBAAS,QAAQ,CAAC,EAChB,IAAI,EACJ,YAAY,EACZ,qBAA6B,EAC7B,QAAe,EACf,aAAa,EACb,QAAQ,EACR,OAAO,EAAE,WAAW,GACrB,EAAE,aAAa,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/RichText/index.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAgB,UAAU,EAAoB,MAAM,OAAO,CAAC;AAanE,OAAO,cAAc,CAAC;AAGtB,KAAK,aAAa,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,IAAI,CAAC;IACzC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC,CAAC;AAEF,iBAAS,QAAQ,CAAC,EAChB,IAAI,EACJ,YAAY,EACZ,qBAA6B,EAC7B,QAAe,EACf,aAAa,EACb,QAAQ,EACR,OAAO,EAAE,WAAW,GACrB,EAAE,aAAa,2CA8Gf;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
-
import isHotkey from "is-hotkey";
|
3
2
|
import { AlignCenter, AlignJustify, AlignLeft, AlignRight, Bold, Code, Heading1, Heading2, Italic, Quote, Underline, } from "lucide-react";
|
4
3
|
import { useCallback, useMemo, useRef, useState } from "react";
|
5
4
|
import { createEditor, Transforms, Node } from "slate";
|
@@ -10,8 +9,6 @@ import { Element } from "./components/Element";
|
|
10
9
|
import { Leaf } from "./components/Leaf";
|
11
10
|
import { MarkButton } from "./components/MarkButton";
|
12
11
|
import { Toolbar } from "./components/Toolbar";
|
13
|
-
import { toggleMark } from "./functions/toggleMark";
|
14
|
-
import { HOTKEYS } from "./template/HOTKEYS";
|
15
12
|
import { INITIAL_VALUE } from "./template/INITIAL_VALUE";
|
16
13
|
import "./styles.css";
|
17
14
|
import { useFormController } from "../Form/FormController";
|
@@ -51,14 +48,6 @@ function RichText({ name, defaultValue, enforceCharacterLimit = false, maxLimit
|
|
51
48
|
: "errorFalse";
|
52
49
|
const className = `arkynRichText ${errorClass} ${focusClass}`;
|
53
50
|
const restatesCharacters = maxLimit - charactersCount;
|
54
|
-
return (_jsxs(Slate, { editor: editor, initialValue: defaultValue ? JSON.parse(defaultValue) : INITIAL_VALUE, onChange: handleChange, onValueChange: handleChange, children: [_jsxs("div", { className: className, children: [_jsxs(Toolbar, { children: [_jsx(BlockButton, { format: "headingOne", icon: Heading1 }), _jsx(BlockButton, { format: "headingTwo", icon: Heading2 }), _jsx(BlockButton, { format: "blockQuote", icon: Quote }), _jsx(MarkButton, { format: "bold", icon: Bold }), _jsx(MarkButton, { format: "italic", icon: Italic }), _jsx(MarkButton, { format: "underline", icon: Underline }), _jsx(MarkButton, { format: "code", icon: Code }), _jsx(BlockButton, { format: "left", icon: AlignLeft }), _jsx(BlockButton, { format: "right", icon: AlignRight }), _jsx(BlockButton, { format: "center", icon: AlignCenter }), _jsx(BlockButton, { format: "justify", icon: AlignJustify })] }), _jsx(Editable, { className: "editorContainer", renderElement: renderElement, renderLeaf: renderLeaf, spellCheck: true, id: id, onFocus: () => setOnFocus(true), onBlur: () => setOnFocus(false),
|
55
|
-
for (const hotkey in HOTKEYS) {
|
56
|
-
if (isHotkey(hotkey, event)) {
|
57
|
-
event.preventDefault();
|
58
|
-
const mark = HOTKEYS[hotkey];
|
59
|
-
toggleMark(editor, mark);
|
60
|
-
}
|
61
|
-
}
|
62
|
-
} }), JSON.stringify(maxLimit), JSON.stringify(charactersCount), JSON.stringify(restatesCharacters), restatesCharacters < 0 && (_jsx("div", { className: "restatesCharacters", children: restatesCharacters }))] }), _jsx("input", { ref: ref, type: "hidden", name: name, value: JSON.stringify(editorValue) })] }));
|
51
|
+
return (_jsxs(Slate, { editor: editor, initialValue: defaultValue ? JSON.parse(defaultValue) : INITIAL_VALUE, onChange: handleChange, onValueChange: handleChange, children: [_jsxs("div", { className: className, children: [_jsxs(Toolbar, { children: [_jsx(BlockButton, { format: "headingOne", icon: Heading1 }), _jsx(BlockButton, { format: "headingTwo", icon: Heading2 }), _jsx(BlockButton, { format: "blockQuote", icon: Quote }), _jsx(MarkButton, { format: "bold", icon: Bold }), _jsx(MarkButton, { format: "italic", icon: Italic }), _jsx(MarkButton, { format: "underline", icon: Underline }), _jsx(MarkButton, { format: "code", icon: Code }), _jsx(BlockButton, { format: "left", icon: AlignLeft }), _jsx(BlockButton, { format: "right", icon: AlignRight }), _jsx(BlockButton, { format: "center", icon: AlignCenter }), _jsx(BlockButton, { format: "justify", icon: AlignJustify })] }), _jsx(Editable, { className: "editorContainer", renderElement: renderElement, renderLeaf: renderLeaf, spellCheck: true, id: id, onFocus: () => setOnFocus(true), onBlur: () => setOnFocus(false) }), restatesCharacters < 0 && (_jsx("div", { className: "restatesCharacters", children: restatesCharacters }))] }), _jsx("input", { ref: ref, type: "hidden", name: name, value: JSON.stringify(editorValue) })] }));
|
63
52
|
}
|
64
53
|
export { RichText };
|
package/package.json
CHANGED
@@ -133,21 +133,17 @@ function RichText({
|
|
133
133
|
id={id}
|
134
134
|
onFocus={() => setOnFocus(true)}
|
135
135
|
onBlur={() => setOnFocus(false)}
|
136
|
-
onKeyDown={(event) => {
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
}}
|
136
|
+
// onKeyDown={(event) => {
|
137
|
+
// for (const hotkey in HOTKEYS) {
|
138
|
+
// if (isHotkey(hotkey, event as any)) {
|
139
|
+
// event.preventDefault();
|
140
|
+
// const mark = HOTKEYS[hotkey as keyof typeof HOTKEYS];
|
141
|
+
// toggleMark(editor, mark);
|
142
|
+
// }
|
143
|
+
// }
|
144
|
+
// }}
|
145
145
|
/>
|
146
146
|
|
147
|
-
{JSON.stringify(maxLimit)}
|
148
|
-
{JSON.stringify(charactersCount)}
|
149
|
-
{JSON.stringify(restatesCharacters)}
|
150
|
-
|
151
147
|
{restatesCharacters < 0 && (
|
152
148
|
<div className="restatesCharacters">{restatesCharacters}</div>
|
153
149
|
)}
|