@tarviks/lexical-rich-editor 1.0.7 → 1.0.8
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/dist/index.js +12 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -1
package/dist/index.js
CHANGED
|
@@ -5053,10 +5053,16 @@ var PRESET = [
|
|
|
5053
5053
|
];
|
|
5054
5054
|
var clamp3 = (v, min, max) => Math.min(max, Math.max(min, v));
|
|
5055
5055
|
var normalizeHex = (v) => {
|
|
5056
|
-
|
|
5056
|
+
const s = (v ?? "").trim();
|
|
5057
5057
|
if (!s) return "#000000";
|
|
5058
|
-
|
|
5059
|
-
if (
|
|
5058
|
+
const rgbMatch = s.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*[\d.]+\s*)?\)$/i);
|
|
5059
|
+
if (rgbMatch) {
|
|
5060
|
+
const [, r, g, b] = rgbMatch;
|
|
5061
|
+
return rgbToHex(clamp3(+r, 0, 255), clamp3(+g, 0, 255), clamp3(+b, 0, 255));
|
|
5062
|
+
}
|
|
5063
|
+
let hex = s.startsWith("#") ? s : `#${s}`;
|
|
5064
|
+
if (hex.length === 9) hex = hex.slice(0, 7);
|
|
5065
|
+
if (hex.length === 4 || hex.length === 7) return hex.toLowerCase();
|
|
5060
5066
|
return "#000000";
|
|
5061
5067
|
};
|
|
5062
5068
|
var hexToRgb = (hex) => {
|
|
@@ -5238,6 +5244,7 @@ var ColorPickerControl = ({ value, title, disabled, onChange, icon }) => {
|
|
|
5238
5244
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5239
5245
|
reactComponents.Button,
|
|
5240
5246
|
{
|
|
5247
|
+
type: "button",
|
|
5241
5248
|
size: "small",
|
|
5242
5249
|
icon,
|
|
5243
5250
|
value: title,
|
|
@@ -5337,13 +5344,14 @@ var ColorPickerControl = ({ value, title, disabled, onChange, icon }) => {
|
|
|
5337
5344
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5338
5345
|
react.DefaultButton,
|
|
5339
5346
|
{
|
|
5347
|
+
type: "button",
|
|
5340
5348
|
text: "Apply",
|
|
5341
5349
|
onClick: () => {
|
|
5342
5350
|
commitHsv(h, s, v, true);
|
|
5343
5351
|
}
|
|
5344
5352
|
}
|
|
5345
5353
|
),
|
|
5346
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.DefaultButton, { text: "Close", onClick: () => setOpen(false) })
|
|
5354
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.DefaultButton, { type: "button", text: "Close", onClick: () => setOpen(false) })
|
|
5347
5355
|
] })
|
|
5348
5356
|
] })
|
|
5349
5357
|
}
|