@frontify/fondue
Version:
Design system of Frontify
28 lines (27 loc) • 988 B
JavaScript
import { ELEMENT_LIC as i, ELEMENT_LI as s, ELEMENT_UL as c, ELEMENT_OL as o } from "@udecode/plate-list";
import { ELEMENT_PARAGRAPH as u } from "@udecode/plate-paragraph";
import { getNodeEntries as T, isNode as f, isText as m } from "@udecode/slate";
import { MARK_TEXT_STYLE as L } from "../../ListPlugin/ListPlugin.es.js";
import { ELEMENT_CHECK_ITEM as l } from "../../CheckboxListPlugin/id.es.js";
const p = (r) => {
if (Array.isArray(r.children)) {
const E = r.children.find((e) => m(e));
return (E == null ? void 0 : E[L]) ?? "";
}
return u;
}, _ = [s, c, o], a = (r) => !r || !r.selection ? [] : Array.from(
T(r, {
unhang: !0,
at: r.selection,
reverse: !0
})
).reduce((e, [t]) => {
if (!f(t))
return e;
const n = t.type === i || t.type === l ? p(t) : t.textStyle || t.type;
return n && !e.includes(n) && !_.includes(n) && e.push(n), e;
}, []);
export {
a as useSelectedTextStyles
};
//# sourceMappingURL=useSelectedTextStyles.es.js.map