@react-fabric/lexical 1.0.0-beta.60 → 1.0.0-beta.62
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/css/_lexical.css +61 -0
- package/dist/cjs/node_modules/date-fns/_lib/addLeadingZeros.js +9 -0
- package/dist/cjs/node_modules/date-fns/_lib/defaultOptions.js +9 -0
- package/dist/cjs/node_modules/date-fns/_lib/format/formatters.js +779 -0
- package/dist/cjs/node_modules/date-fns/_lib/format/lightFormatters.js +96 -0
- package/dist/cjs/node_modules/date-fns/_lib/format/longFormatters.js +68 -0
- package/dist/cjs/node_modules/date-fns/_lib/getRoundingMethod.js +12 -0
- package/dist/cjs/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +33 -0
- package/dist/cjs/node_modules/date-fns/_lib/normalizeDates.js +13 -0
- package/dist/cjs/node_modules/date-fns/_lib/normalizeInterval.js +10 -0
- package/dist/cjs/node_modules/date-fns/_lib/protectedTokens.js +29 -0
- package/dist/cjs/node_modules/date-fns/add.js +73 -0
- package/dist/cjs/node_modules/date-fns/addDays.js +46 -0
- package/dist/cjs/node_modules/date-fns/addHours.js +39 -0
- package/dist/cjs/node_modules/date-fns/addMilliseconds.js +39 -0
- package/dist/cjs/node_modules/date-fns/addMinutes.js +41 -0
- package/dist/cjs/node_modules/date-fns/addMonths.js +80 -0
- package/dist/cjs/node_modules/date-fns/addQuarters.js +38 -0
- package/dist/cjs/node_modules/date-fns/addWeeks.js +38 -0
- package/dist/cjs/node_modules/date-fns/addYears.js +38 -0
- package/dist/cjs/node_modules/date-fns/compareAsc.js +50 -0
- package/dist/cjs/node_modules/date-fns/constants.js +66 -0
- package/dist/cjs/node_modules/date-fns/constructFrom.js +54 -0
- package/dist/cjs/node_modules/date-fns/differenceInCalendarDays.js +67 -0
- package/dist/cjs/node_modules/date-fns/differenceInCalendarMonths.js +47 -0
- package/dist/cjs/node_modules/date-fns/differenceInCalendarYears.js +43 -0
- package/dist/cjs/node_modules/date-fns/differenceInDays.js +112 -0
- package/dist/cjs/node_modules/date-fns/differenceInHours.js +46 -0
- package/dist/cjs/node_modules/date-fns/differenceInMilliseconds.js +34 -0
- package/dist/cjs/node_modules/date-fns/differenceInMinutes.js +50 -0
- package/dist/cjs/node_modules/date-fns/differenceInMonths.js +65 -0
- package/dist/cjs/node_modules/date-fns/differenceInSeconds.js +41 -0
- package/dist/cjs/node_modules/date-fns/differenceInYears.js +67 -0
- package/dist/cjs/node_modules/date-fns/endOfDay.js +40 -0
- package/dist/cjs/node_modules/date-fns/endOfDecade.js +45 -0
- package/dist/cjs/node_modules/date-fns/endOfHour.js +40 -0
- package/dist/cjs/node_modules/date-fns/endOfMinute.js +40 -0
- package/dist/cjs/node_modules/date-fns/endOfMonth.js +42 -0
- package/dist/cjs/node_modules/date-fns/endOfQuarter.js +43 -0
- package/dist/cjs/node_modules/date-fns/endOfWeek.js +58 -0
- package/dist/cjs/node_modules/date-fns/endOfYear.js +42 -0
- package/dist/cjs/node_modules/date-fns/format.js +431 -0
- package/dist/cjs/node_modules/date-fns/getDayOfYear.js +39 -0
- package/dist/cjs/node_modules/date-fns/getISOWeek.js +45 -0
- package/dist/cjs/node_modules/date-fns/getISOWeekYear.js +57 -0
- package/dist/cjs/node_modules/date-fns/getWeek.js +59 -0
- package/dist/cjs/node_modules/date-fns/getWeekYear.js +80 -0
- package/dist/cjs/node_modules/date-fns/intervalToDuration.js +70 -0
- package/dist/cjs/node_modules/date-fns/isAfter.js +30 -0
- package/dist/cjs/node_modules/date-fns/isBefore.js +30 -0
- package/dist/cjs/node_modules/date-fns/isDate.js +46 -0
- package/dist/cjs/node_modules/date-fns/isLastDayOfMonth.js +33 -0
- package/dist/cjs/node_modules/date-fns/isSameMonth.js +48 -0
- package/dist/cjs/node_modules/date-fns/isSameWeek.js +56 -0
- package/dist/cjs/node_modules/date-fns/isSameYear.js +40 -0
- package/dist/cjs/node_modules/date-fns/isValid.js +44 -0
- package/dist/cjs/node_modules/date-fns/locale/_lib/buildFormatLongFn.js +12 -0
- package/dist/cjs/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +66 -0
- package/dist/cjs/node_modules/date-fns/locale/_lib/buildMatchFn.js +61 -0
- package/dist/cjs/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js +24 -0
- package/dist/cjs/node_modules/date-fns/locale/ar-SA/_lib/formatDistance.js +139 -0
- package/dist/cjs/node_modules/date-fns/locale/ar-SA/_lib/formatLong.js +43 -0
- package/dist/cjs/node_modules/date-fns/locale/ar-SA/_lib/formatRelative.js +15 -0
- package/dist/cjs/node_modules/date-fns/locale/ar-SA/_lib/localize.js +166 -0
- package/dist/cjs/node_modules/date-fns/locale/ar-SA/_lib/match.js +146 -0
- package/dist/cjs/node_modules/date-fns/locale/ar-SA.js +32 -0
- package/dist/cjs/node_modules/date-fns/locale/de/_lib/formatDistance.js +200 -0
- package/dist/cjs/node_modules/date-fns/locale/de/_lib/formatLong.js +44 -0
- package/dist/cjs/node_modules/date-fns/locale/de/_lib/formatRelative.js +15 -0
- package/dist/cjs/node_modules/date-fns/locale/de/_lib/localize.js +195 -0
- package/dist/cjs/node_modules/date-fns/locale/de/_lib/match.js +138 -0
- package/dist/cjs/node_modules/date-fns/locale/de.js +36 -0
- package/dist/cjs/node_modules/date-fns/locale/en-US/_lib/formatDistance.js +105 -0
- package/dist/cjs/node_modules/date-fns/locale/en-US/_lib/formatLong.js +43 -0
- package/dist/cjs/node_modules/date-fns/locale/en-US/_lib/formatRelative.js +15 -0
- package/dist/cjs/node_modules/date-fns/locale/en-US/_lib/localize.js +191 -0
- package/dist/cjs/node_modules/date-fns/locale/en-US/_lib/match.js +136 -0
- package/dist/cjs/node_modules/date-fns/locale/en-US.js +33 -0
- package/dist/cjs/node_modules/date-fns/locale/es/_lib/formatDistance.js +105 -0
- package/dist/cjs/node_modules/date-fns/locale/es/_lib/formatLong.js +43 -0
- package/dist/cjs/node_modules/date-fns/locale/es/_lib/formatRelative.js +29 -0
- package/dist/cjs/node_modules/date-fns/locale/es/_lib/localize.js +168 -0
- package/dist/cjs/node_modules/date-fns/locale/es/_lib/match.js +142 -0
- package/dist/cjs/node_modules/date-fns/locale/es.js +36 -0
- package/dist/cjs/node_modules/date-fns/locale/fr/_lib/formatDistance.js +104 -0
- package/dist/cjs/node_modules/date-fns/locale/fr/_lib/formatLong.js +43 -0
- package/dist/cjs/node_modules/date-fns/locale/fr/_lib/formatRelative.js +15 -0
- package/dist/cjs/node_modules/date-fns/locale/fr/_lib/localize.js +169 -0
- package/dist/cjs/node_modules/date-fns/locale/fr/_lib/match.js +137 -0
- package/dist/cjs/node_modules/date-fns/locale/fr.js +33 -0
- package/dist/cjs/node_modules/date-fns/locale/hi/_lib/formatDistance.js +109 -0
- package/dist/cjs/node_modules/date-fns/locale/hi/_lib/formatLong.js +43 -0
- package/dist/cjs/node_modules/date-fns/locale/hi/_lib/formatRelative.js +15 -0
- package/dist/cjs/node_modules/date-fns/locale/hi/_lib/localize.js +233 -0
- package/dist/cjs/node_modules/date-fns/locale/hi/_lib/match.js +141 -0
- package/dist/cjs/node_modules/date-fns/locale/hi.js +32 -0
- package/dist/cjs/node_modules/date-fns/locale/it/_lib/formatDistance.js +105 -0
- package/dist/cjs/node_modules/date-fns/locale/it/_lib/formatLong.js +43 -0
- package/dist/cjs/node_modules/date-fns/locale/it/_lib/formatRelative.js +70 -0
- package/dist/cjs/node_modules/date-fns/locale/it/_lib/localize.js +168 -0
- package/dist/cjs/node_modules/date-fns/locale/it/_lib/match.js +137 -0
- package/dist/cjs/node_modules/date-fns/locale/it.js +34 -0
- package/dist/cjs/node_modules/date-fns/locale/ja/_lib/formatDistance.js +119 -0
- package/dist/cjs/node_modules/date-fns/locale/ja/_lib/formatLong.js +43 -0
- package/dist/cjs/node_modules/date-fns/locale/ja/_lib/formatRelative.js +16 -0
- package/dist/cjs/node_modules/date-fns/locale/ja/_lib/localize.js +181 -0
- package/dist/cjs/node_modules/date-fns/locale/ja/_lib/match.js +122 -0
- package/dist/cjs/node_modules/date-fns/locale/ja.js +36 -0
- package/dist/cjs/node_modules/date-fns/locale/ko/_lib/formatDistance.js +105 -0
- package/dist/cjs/node_modules/date-fns/locale/ko/_lib/formatLong.js +43 -0
- package/dist/cjs/node_modules/date-fns/locale/ko/_lib/formatRelative.js +15 -0
- package/dist/cjs/node_modules/date-fns/locale/ko/_lib/localize.js +171 -0
- package/dist/cjs/node_modules/date-fns/locale/ko/_lib/match.js +119 -0
- package/dist/cjs/node_modules/date-fns/locale/ko.js +34 -0
- package/dist/cjs/node_modules/date-fns/locale/pt/_lib/formatDistance.js +105 -0
- package/dist/cjs/node_modules/date-fns/locale/pt/_lib/formatLong.js +43 -0
- package/dist/cjs/node_modules/date-fns/locale/pt/_lib/formatRelative.js +26 -0
- package/dist/cjs/node_modules/date-fns/locale/pt/_lib/localize.js +168 -0
- package/dist/cjs/node_modules/date-fns/locale/pt/_lib/match.js +141 -0
- package/dist/cjs/node_modules/date-fns/locale/pt.js +33 -0
- package/dist/cjs/node_modules/date-fns/locale/ru/_lib/formatDistance.js +250 -0
- package/dist/cjs/node_modules/date-fns/locale/ru/_lib/formatLong.js +40 -0
- package/dist/cjs/node_modules/date-fns/locale/ru/_lib/formatRelative.js +92 -0
- package/dist/cjs/node_modules/date-fns/locale/ru/_lib/localize.js +214 -0
- package/dist/cjs/node_modules/date-fns/locale/ru/_lib/match.js +142 -0
- package/dist/cjs/node_modules/date-fns/locale/ru.js +33 -0
- package/dist/cjs/node_modules/date-fns/locale/zh-CN/_lib/formatDistance.js +105 -0
- package/dist/cjs/node_modules/date-fns/locale/zh-CN/_lib/formatLong.js +43 -0
- package/dist/cjs/node_modules/date-fns/locale/zh-CN/_lib/formatRelative.js +35 -0
- package/dist/cjs/node_modules/date-fns/locale/zh-CN/_lib/localize.js +187 -0
- package/dist/cjs/node_modules/date-fns/locale/zh-CN/_lib/match.js +134 -0
- package/dist/cjs/node_modules/date-fns/locale/zh-CN.js +36 -0
- package/dist/cjs/node_modules/date-fns/startOfDay.js +40 -0
- package/dist/cjs/node_modules/date-fns/startOfDecade.js +45 -0
- package/dist/cjs/node_modules/date-fns/startOfHour.js +40 -0
- package/dist/cjs/node_modules/date-fns/startOfISOWeek.js +40 -0
- package/dist/cjs/node_modules/date-fns/startOfISOWeekYear.js +47 -0
- package/dist/cjs/node_modules/date-fns/startOfMinute.js +40 -0
- package/dist/cjs/node_modules/date-fns/startOfMonth.js +42 -0
- package/dist/cjs/node_modules/date-fns/startOfQuarter.js +43 -0
- package/dist/cjs/node_modules/date-fns/startOfWeek.js +58 -0
- package/dist/cjs/node_modules/date-fns/startOfWeekYear.js +69 -0
- package/dist/cjs/node_modules/date-fns/startOfYear.js +41 -0
- package/dist/cjs/node_modules/date-fns/toDate.js +51 -0
- package/dist/cjs/packages/date/dist/esm/display/DateDuration.js +178 -0
- package/dist/cjs/packages/date/dist/esm/hijri/DateConverter.js +154 -0
- package/dist/cjs/packages/date/dist/esm/hijri/FormatDate.js +116 -0
- package/dist/cjs/packages/date/dist/esm/hijri/HijriDate.js +531 -0
- package/dist/cjs/packages/date/dist/esm/hijri/StringDateParser.js +74 -0
- package/dist/cjs/packages/date/dist/esm/hijri/index.js +21 -0
- package/dist/cjs/packages/date/dist/esm/hijri/initializer.js +113 -0
- package/dist/cjs/packages/date/dist/esm/hijri/locales.js +19 -0
- package/dist/cjs/packages/date/dist/esm/hijri/safe.js +17 -0
- package/dist/cjs/packages/date/dist/esm/i18n/ar/date.json.js +213 -0
- package/dist/cjs/packages/date/dist/esm/i18n/en/date.json.js +83 -0
- package/{src/plugins/StickyPlugin.ts → dist/cjs/packages/date/dist/esm/i18n/index.js} +10 -15
- package/dist/cjs/packages/date/dist/esm/types/index.js +46 -0
- package/dist/cjs/packages/date/dist/esm/utils/dateUtil.js +472 -0
- package/dist/cjs/packages/lexical/src/editor/LexicalEditor.js +36 -13
- package/dist/cjs/packages/lexical/src/hooks/useFormatWatcher.js +101 -95
- package/dist/cjs/packages/lexical/src/i18n/ar/lexical.json.js +30 -0
- package/dist/cjs/packages/lexical/src/i18n/en/lexical.json.js +30 -0
- package/dist/cjs/packages/lexical/src/i18n/index.js +33 -0
- package/dist/cjs/packages/lexical/src/index.js +1 -0
- package/dist/cjs/packages/lexical/src/plugins/CommentPlugin.js +477 -0
- package/dist/cjs/packages/lexical/src/plugins/DraggableBlockPlugin.js +13 -16
- package/dist/cjs/packages/lexical/src/plugins/ToolbarPlugin.js +35 -22
- package/dist/esm/node_modules/date-fns/_lib/addLeadingZeros.js +9 -0
- package/dist/esm/node_modules/date-fns/_lib/defaultOptions.js +9 -0
- package/dist/esm/node_modules/date-fns/_lib/format/formatters.js +779 -0
- package/dist/esm/node_modules/date-fns/_lib/format/lightFormatters.js +96 -0
- package/dist/esm/node_modules/date-fns/_lib/format/longFormatters.js +68 -0
- package/dist/esm/node_modules/date-fns/_lib/getRoundingMethod.js +12 -0
- package/dist/esm/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +33 -0
- package/dist/esm/node_modules/date-fns/_lib/normalizeDates.js +13 -0
- package/dist/esm/node_modules/date-fns/_lib/normalizeInterval.js +10 -0
- package/dist/esm/node_modules/date-fns/_lib/protectedTokens.js +27 -0
- package/dist/esm/node_modules/date-fns/add.js +70 -0
- package/dist/esm/node_modules/date-fns/addDays.js +43 -0
- package/dist/esm/node_modules/date-fns/addHours.js +36 -0
- package/dist/esm/node_modules/date-fns/addMilliseconds.js +36 -0
- package/dist/esm/node_modules/date-fns/addMinutes.js +38 -0
- package/dist/esm/node_modules/date-fns/addMonths.js +77 -0
- package/dist/esm/node_modules/date-fns/addQuarters.js +35 -0
- package/dist/esm/node_modules/date-fns/addWeeks.js +35 -0
- package/dist/esm/node_modules/date-fns/addYears.js +35 -0
- package/dist/esm/node_modules/date-fns/compareAsc.js +47 -0
- package/dist/esm/node_modules/date-fns/constants.js +62 -0
- package/dist/esm/node_modules/date-fns/constructFrom.js +51 -0
- package/dist/esm/node_modules/date-fns/differenceInCalendarDays.js +64 -0
- package/dist/esm/node_modules/date-fns/differenceInCalendarMonths.js +44 -0
- package/dist/esm/node_modules/date-fns/differenceInCalendarYears.js +40 -0
- package/dist/esm/node_modules/date-fns/differenceInDays.js +109 -0
- package/dist/esm/node_modules/date-fns/differenceInHours.js +43 -0
- package/dist/esm/node_modules/date-fns/differenceInMilliseconds.js +31 -0
- package/dist/esm/node_modules/date-fns/differenceInMinutes.js +47 -0
- package/dist/esm/node_modules/date-fns/differenceInMonths.js +62 -0
- package/dist/esm/node_modules/date-fns/differenceInSeconds.js +38 -0
- package/dist/esm/node_modules/date-fns/differenceInYears.js +64 -0
- package/dist/esm/node_modules/date-fns/endOfDay.js +37 -0
- package/dist/esm/node_modules/date-fns/endOfDecade.js +42 -0
- package/dist/esm/node_modules/date-fns/endOfHour.js +37 -0
- package/dist/esm/node_modules/date-fns/endOfMinute.js +37 -0
- package/dist/esm/node_modules/date-fns/endOfMonth.js +39 -0
- package/dist/esm/node_modules/date-fns/endOfQuarter.js +40 -0
- package/dist/esm/node_modules/date-fns/endOfWeek.js +55 -0
- package/dist/esm/node_modules/date-fns/endOfYear.js +39 -0
- package/dist/esm/node_modules/date-fns/format.js +425 -0
- package/dist/esm/node_modules/date-fns/getDayOfYear.js +36 -0
- package/dist/esm/node_modules/date-fns/getISOWeek.js +42 -0
- package/dist/esm/node_modules/date-fns/getISOWeekYear.js +54 -0
- package/dist/esm/node_modules/date-fns/getWeek.js +56 -0
- package/dist/esm/node_modules/date-fns/getWeekYear.js +77 -0
- package/dist/esm/node_modules/date-fns/intervalToDuration.js +67 -0
- package/dist/esm/node_modules/date-fns/isAfter.js +27 -0
- package/dist/esm/node_modules/date-fns/isBefore.js +27 -0
- package/dist/esm/node_modules/date-fns/isDate.js +43 -0
- package/dist/esm/node_modules/date-fns/isLastDayOfMonth.js +30 -0
- package/dist/esm/node_modules/date-fns/isSameMonth.js +45 -0
- package/dist/esm/node_modules/date-fns/isSameWeek.js +53 -0
- package/dist/esm/node_modules/date-fns/isSameYear.js +37 -0
- package/dist/esm/node_modules/date-fns/isValid.js +41 -0
- package/dist/esm/node_modules/date-fns/locale/_lib/buildFormatLongFn.js +12 -0
- package/dist/esm/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +66 -0
- package/dist/esm/node_modules/date-fns/locale/_lib/buildMatchFn.js +61 -0
- package/dist/esm/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js +24 -0
- package/dist/esm/node_modules/date-fns/locale/ar-SA/_lib/formatDistance.js +139 -0
- package/dist/esm/node_modules/date-fns/locale/ar-SA/_lib/formatLong.js +43 -0
- package/dist/esm/node_modules/date-fns/locale/ar-SA/_lib/formatRelative.js +15 -0
- package/dist/esm/node_modules/date-fns/locale/ar-SA/_lib/localize.js +166 -0
- package/dist/esm/node_modules/date-fns/locale/ar-SA/_lib/match.js +146 -0
- package/dist/esm/node_modules/date-fns/locale/ar-SA.js +29 -0
- package/dist/esm/node_modules/date-fns/locale/de/_lib/formatDistance.js +200 -0
- package/dist/esm/node_modules/date-fns/locale/de/_lib/formatLong.js +44 -0
- package/dist/esm/node_modules/date-fns/locale/de/_lib/formatRelative.js +15 -0
- package/dist/esm/node_modules/date-fns/locale/de/_lib/localize.js +195 -0
- package/dist/esm/node_modules/date-fns/locale/de/_lib/match.js +138 -0
- package/dist/esm/node_modules/date-fns/locale/de.js +33 -0
- package/dist/esm/node_modules/date-fns/locale/en-US/_lib/formatDistance.js +105 -0
- package/dist/esm/node_modules/date-fns/locale/en-US/_lib/formatLong.js +43 -0
- package/dist/esm/node_modules/date-fns/locale/en-US/_lib/formatRelative.js +15 -0
- package/dist/esm/node_modules/date-fns/locale/en-US/_lib/localize.js +191 -0
- package/dist/esm/node_modules/date-fns/locale/en-US/_lib/match.js +136 -0
- package/dist/esm/node_modules/date-fns/locale/en-US.js +30 -0
- package/dist/esm/node_modules/date-fns/locale/es/_lib/formatDistance.js +105 -0
- package/dist/esm/node_modules/date-fns/locale/es/_lib/formatLong.js +43 -0
- package/dist/esm/node_modules/date-fns/locale/es/_lib/formatRelative.js +29 -0
- package/dist/esm/node_modules/date-fns/locale/es/_lib/localize.js +168 -0
- package/dist/esm/node_modules/date-fns/locale/es/_lib/match.js +142 -0
- package/dist/esm/node_modules/date-fns/locale/es.js +33 -0
- package/dist/esm/node_modules/date-fns/locale/fr/_lib/formatDistance.js +104 -0
- package/dist/esm/node_modules/date-fns/locale/fr/_lib/formatLong.js +43 -0
- package/dist/esm/node_modules/date-fns/locale/fr/_lib/formatRelative.js +15 -0
- package/dist/esm/node_modules/date-fns/locale/fr/_lib/localize.js +169 -0
- package/dist/esm/node_modules/date-fns/locale/fr/_lib/match.js +137 -0
- package/dist/esm/node_modules/date-fns/locale/fr.js +30 -0
- package/dist/esm/node_modules/date-fns/locale/hi/_lib/formatDistance.js +109 -0
- package/dist/esm/node_modules/date-fns/locale/hi/_lib/formatLong.js +43 -0
- package/dist/esm/node_modules/date-fns/locale/hi/_lib/formatRelative.js +15 -0
- package/dist/esm/node_modules/date-fns/locale/hi/_lib/localize.js +231 -0
- package/dist/esm/node_modules/date-fns/locale/hi/_lib/match.js +141 -0
- package/dist/esm/node_modules/date-fns/locale/hi.js +29 -0
- package/dist/esm/node_modules/date-fns/locale/it/_lib/formatDistance.js +105 -0
- package/dist/esm/node_modules/date-fns/locale/it/_lib/formatLong.js +43 -0
- package/dist/esm/node_modules/date-fns/locale/it/_lib/formatRelative.js +70 -0
- package/dist/esm/node_modules/date-fns/locale/it/_lib/localize.js +168 -0
- package/dist/esm/node_modules/date-fns/locale/it/_lib/match.js +137 -0
- package/dist/esm/node_modules/date-fns/locale/it.js +31 -0
- package/dist/esm/node_modules/date-fns/locale/ja/_lib/formatDistance.js +119 -0
- package/dist/esm/node_modules/date-fns/locale/ja/_lib/formatLong.js +43 -0
- package/dist/esm/node_modules/date-fns/locale/ja/_lib/formatRelative.js +16 -0
- package/dist/esm/node_modules/date-fns/locale/ja/_lib/localize.js +181 -0
- package/dist/esm/node_modules/date-fns/locale/ja/_lib/match.js +122 -0
- package/dist/esm/node_modules/date-fns/locale/ja.js +33 -0
- package/dist/esm/node_modules/date-fns/locale/ko/_lib/formatDistance.js +105 -0
- package/dist/esm/node_modules/date-fns/locale/ko/_lib/formatLong.js +43 -0
- package/dist/esm/node_modules/date-fns/locale/ko/_lib/formatRelative.js +15 -0
- package/dist/esm/node_modules/date-fns/locale/ko/_lib/localize.js +171 -0
- package/dist/esm/node_modules/date-fns/locale/ko/_lib/match.js +119 -0
- package/dist/esm/node_modules/date-fns/locale/ko.js +31 -0
- package/dist/esm/node_modules/date-fns/locale/pt/_lib/formatDistance.js +105 -0
- package/dist/esm/node_modules/date-fns/locale/pt/_lib/formatLong.js +43 -0
- package/dist/esm/node_modules/date-fns/locale/pt/_lib/formatRelative.js +26 -0
- package/dist/esm/node_modules/date-fns/locale/pt/_lib/localize.js +168 -0
- package/dist/esm/node_modules/date-fns/locale/pt/_lib/match.js +141 -0
- package/dist/esm/node_modules/date-fns/locale/pt.js +30 -0
- package/dist/esm/node_modules/date-fns/locale/ru/_lib/formatDistance.js +250 -0
- package/dist/esm/node_modules/date-fns/locale/ru/_lib/formatLong.js +40 -0
- package/dist/esm/node_modules/date-fns/locale/ru/_lib/formatRelative.js +92 -0
- package/dist/esm/node_modules/date-fns/locale/ru/_lib/localize.js +214 -0
- package/dist/esm/node_modules/date-fns/locale/ru/_lib/match.js +142 -0
- package/dist/esm/node_modules/date-fns/locale/ru.js +30 -0
- package/dist/esm/node_modules/date-fns/locale/zh-CN/_lib/formatDistance.js +105 -0
- package/dist/esm/node_modules/date-fns/locale/zh-CN/_lib/formatLong.js +43 -0
- package/dist/esm/node_modules/date-fns/locale/zh-CN/_lib/formatRelative.js +35 -0
- package/dist/esm/node_modules/date-fns/locale/zh-CN/_lib/localize.js +187 -0
- package/dist/esm/node_modules/date-fns/locale/zh-CN/_lib/match.js +134 -0
- package/dist/esm/node_modules/date-fns/locale/zh-CN.js +33 -0
- package/dist/esm/node_modules/date-fns/startOfDay.js +37 -0
- package/dist/esm/node_modules/date-fns/startOfDecade.js +42 -0
- package/dist/esm/node_modules/date-fns/startOfHour.js +37 -0
- package/dist/esm/node_modules/date-fns/startOfISOWeek.js +37 -0
- package/dist/esm/node_modules/date-fns/startOfISOWeekYear.js +44 -0
- package/dist/esm/node_modules/date-fns/startOfMinute.js +37 -0
- package/dist/esm/node_modules/date-fns/startOfMonth.js +39 -0
- package/dist/esm/node_modules/date-fns/startOfQuarter.js +40 -0
- package/dist/esm/node_modules/date-fns/startOfWeek.js +55 -0
- package/dist/esm/node_modules/date-fns/startOfWeekYear.js +66 -0
- package/dist/esm/node_modules/date-fns/startOfYear.js +38 -0
- package/dist/esm/node_modules/date-fns/toDate.js +48 -0
- package/dist/esm/packages/date/dist/esm/display/DateDuration.js +178 -0
- package/dist/esm/packages/date/dist/esm/hijri/DateConverter.js +152 -0
- package/dist/esm/packages/date/dist/esm/hijri/FormatDate.js +113 -0
- package/dist/esm/packages/date/dist/esm/hijri/HijriDate.js +528 -0
- package/dist/esm/packages/date/dist/esm/hijri/StringDateParser.js +74 -0
- package/dist/esm/packages/date/dist/esm/hijri/index.js +21 -0
- package/dist/esm/packages/date/dist/esm/hijri/initializer.js +113 -0
- package/dist/esm/packages/date/dist/esm/hijri/locales.js +18 -0
- package/dist/esm/packages/date/dist/esm/hijri/safe.js +14 -0
- package/dist/esm/packages/date/dist/esm/i18n/ar/date.json.js +209 -0
- package/dist/esm/packages/date/dist/esm/i18n/en/date.json.js +79 -0
- package/dist/esm/packages/date/dist/esm/i18n/index.js +33 -0
- package/dist/esm/packages/date/dist/esm/types/index.js +45 -0
- package/dist/esm/packages/date/dist/esm/utils/dateUtil.js +474 -0
- package/dist/esm/packages/lexical/src/editor/LexicalEditor.js +37 -14
- package/dist/esm/packages/lexical/src/hooks/useFormatWatcher.js +43 -37
- package/dist/esm/packages/lexical/src/i18n/ar/lexical.json.js +25 -0
- package/dist/esm/packages/lexical/src/i18n/en/lexical.json.js +25 -0
- package/dist/esm/packages/lexical/src/i18n/index.js +33 -0
- package/dist/esm/packages/lexical/src/index.js +1 -0
- package/dist/esm/packages/lexical/src/plugins/CommentPlugin.js +477 -0
- package/dist/esm/packages/lexical/src/plugins/DraggableBlockPlugin.js +11 -14
- package/dist/esm/packages/lexical/src/plugins/ToolbarPlugin.js +36 -23
- package/dist/types/editor/LexicalEditor.d.ts +12 -3
- package/dist/types/hooks/useFormatWatcher.d.ts +2 -1
- package/dist/types/i18n/index.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/plugins/CommentPlugin.d.ts +5 -0
- package/dist/types/plugins/DraggableBlockPlugin.d.ts +2 -1
- package/package.json +5 -5
- package/src/editor/LexicalEditor.tsx +65 -18
- package/src/hooks/useFormatWatcher.ts +3 -0
- package/src/i18n/ar/lexical.json +18 -0
- package/src/i18n/en/lexical.json +18 -0
- package/src/i18n/index.ts +28 -0
- package/src/index.ts +2 -0
- package/src/plugins/CommentPlugin.tsx +554 -0
- package/src/plugins/DraggableBlockPlugin.tsx +5 -10
- package/src/plugins/ToolbarPlugin.tsx +34 -23
- package/dist/cjs/_virtual/prism.js +0 -5
- package/dist/cjs/node_modules/@lexical/clipboard/LexicalClipboard.dev.js +0 -474
- package/dist/cjs/node_modules/@lexical/clipboard/LexicalClipboard.js +0 -21
- package/dist/cjs/node_modules/@lexical/clipboard/LexicalClipboard.prod.js +0 -27
- package/dist/cjs/node_modules/@lexical/code/LexicalCode.dev.js +0 -1537
- package/dist/cjs/node_modules/@lexical/code/LexicalCode.js +0 -25
- package/dist/cjs/node_modules/@lexical/code/LexicalCode.prod.js +0 -57
- package/dist/cjs/node_modules/@lexical/html/LexicalHtml.dev.js +0 -252
- package/dist/cjs/node_modules/@lexical/html/LexicalHtml.js +0 -19
- package/dist/cjs/node_modules/@lexical/html/LexicalHtml.prod.js +0 -18
- package/dist/cjs/node_modules/@lexical/link/LexicalLink.dev.js +0 -572
- package/dist/cjs/node_modules/@lexical/link/LexicalLink.js +0 -17
- package/dist/cjs/node_modules/@lexical/link/LexicalLink.prod.js +0 -25
- package/dist/cjs/node_modules/@lexical/list/LexicalList.dev.js +0 -1614
- package/dist/cjs/node_modules/@lexical/list/LexicalList.js +0 -29
- package/dist/cjs/node_modules/@lexical/list/LexicalList.prod.js +0 -36
- package/dist/cjs/node_modules/@lexical/rich-text/LexicalRichText.dev.js +0 -838
- package/dist/cjs/node_modules/@lexical/rich-text/LexicalRichText.js +0 -29
- package/dist/cjs/node_modules/@lexical/rich-text/LexicalRichText.prod.js +0 -26
- package/dist/cjs/node_modules/@lexical/selection/LexicalSelection.dev.js +0 -1057
- package/dist/cjs/node_modules/@lexical/selection/LexicalSelection.js +0 -39
- package/dist/cjs/node_modules/@lexical/selection/LexicalSelection.prod.js +0 -45
- package/dist/cjs/node_modules/@lexical/table/LexicalTable.dev.js +0 -4207
- package/dist/cjs/node_modules/@lexical/table/LexicalTable.js +0 -23
- package/dist/cjs/node_modules/@lexical/table/LexicalTable.prod.js +0 -68
- package/dist/cjs/node_modules/@lexical/utils/LexicalUtils.dev.js +0 -1166
- package/dist/cjs/node_modules/@lexical/utils/LexicalUtils.js +0 -47
- package/dist/cjs/node_modules/@lexical/utils/LexicalUtils.prod.js +0 -81
- package/dist/cjs/node_modules/@mdi/js/mdi.js +0 -8
- package/dist/cjs/node_modules/prismjs/components/prism-c.js +0 -82
- package/dist/cjs/node_modules/prismjs/components/prism-clike.js +0 -33
- package/dist/cjs/node_modules/prismjs/components/prism-cpp.js +0 -101
- package/dist/cjs/node_modules/prismjs/components/prism-css.js +0 -66
- package/dist/cjs/node_modules/prismjs/components/prism-java.js +0 -126
- package/dist/cjs/node_modules/prismjs/components/prism-javascript.js +0 -174
- package/dist/cjs/node_modules/prismjs/components/prism-markdown.js +0 -417
- package/dist/cjs/node_modules/prismjs/components/prism-markup.js +0 -188
- package/dist/cjs/node_modules/prismjs/components/prism-objectivec.js +0 -14
- package/dist/cjs/node_modules/prismjs/components/prism-powershell.js +0 -60
- package/dist/cjs/node_modules/prismjs/components/prism-python.js +0 -67
- package/dist/cjs/node_modules/prismjs/components/prism-rust.js +0 -130
- package/dist/cjs/node_modules/prismjs/components/prism-sql.js +0 -34
- package/dist/cjs/node_modules/prismjs/components/prism-swift.js +0 -150
- package/dist/cjs/node_modules/prismjs/components/prism-typescript.js +0 -62
- package/dist/cjs/node_modules/prismjs/prism.js +0 -1951
- package/dist/cjs/packages/lexical/src/components/StickyComponent.js +0 -221
- package/dist/cjs/packages/lexical/src/nodes/StickyNode.js +0 -218
- package/dist/cjs/packages/lexical/src/plugins/StickyPlugin.js +0 -20
- package/dist/esm/_virtual/prism.js +0 -5
- package/dist/esm/node_modules/@lexical/clipboard/LexicalClipboard.dev.js +0 -465
- package/dist/esm/node_modules/@lexical/clipboard/LexicalClipboard.js +0 -19
- package/dist/esm/node_modules/@lexical/clipboard/LexicalClipboard.prod.js +0 -18
- package/dist/esm/node_modules/@lexical/code/LexicalCode.dev.js +0 -1512
- package/dist/esm/node_modules/@lexical/code/LexicalCode.js +0 -21
- package/dist/esm/node_modules/@lexical/code/LexicalCode.prod.js +0 -32
- package/dist/esm/node_modules/@lexical/html/LexicalHtml.dev.js +0 -251
- package/dist/esm/node_modules/@lexical/html/LexicalHtml.js +0 -18
- package/dist/esm/node_modules/@lexical/html/LexicalHtml.prod.js +0 -17
- package/dist/esm/node_modules/@lexical/link/LexicalLink.dev.js +0 -563
- package/dist/esm/node_modules/@lexical/link/LexicalLink.js +0 -17
- package/dist/esm/node_modules/@lexical/link/LexicalLink.prod.js +0 -16
- package/dist/esm/node_modules/@lexical/list/LexicalList.dev.js +0 -1595
- package/dist/esm/node_modules/@lexical/list/LexicalList.js +0 -23
- package/dist/esm/node_modules/@lexical/list/LexicalList.prod.js +0 -17
- package/dist/esm/node_modules/@lexical/rich-text/LexicalRichText.dev.js +0 -830
- package/dist/esm/node_modules/@lexical/rich-text/LexicalRichText.js +0 -23
- package/dist/esm/node_modules/@lexical/rich-text/LexicalRichText.prod.js +0 -18
- package/dist/esm/node_modules/@lexical/selection/LexicalSelection.dev.js +0 -1028
- package/dist/esm/node_modules/@lexical/selection/LexicalSelection.js +0 -28
- package/dist/esm/node_modules/@lexical/selection/LexicalSelection.prod.js +0 -16
- package/dist/esm/node_modules/@lexical/table/LexicalTable.dev.js +0 -4156
- package/dist/esm/node_modules/@lexical/table/LexicalTable.js +0 -20
- package/dist/esm/node_modules/@lexical/table/LexicalTable.prod.js +0 -17
- package/dist/esm/node_modules/@lexical/utils/LexicalUtils.dev.js +0 -1102
- package/dist/esm/node_modules/@lexical/utils/LexicalUtils.js +0 -32
- package/dist/esm/node_modules/@lexical/utils/LexicalUtils.prod.js +0 -17
- package/dist/esm/node_modules/@mdi/js/mdi.js +0 -7
- package/dist/esm/node_modules/prismjs/components/prism-c.js +0 -82
- package/dist/esm/node_modules/prismjs/components/prism-clike.js +0 -33
- package/dist/esm/node_modules/prismjs/components/prism-cpp.js +0 -101
- package/dist/esm/node_modules/prismjs/components/prism-css.js +0 -66
- package/dist/esm/node_modules/prismjs/components/prism-java.js +0 -126
- package/dist/esm/node_modules/prismjs/components/prism-javascript.js +0 -174
- package/dist/esm/node_modules/prismjs/components/prism-markdown.js +0 -417
- package/dist/esm/node_modules/prismjs/components/prism-markup.js +0 -188
- package/dist/esm/node_modules/prismjs/components/prism-objectivec.js +0 -14
- package/dist/esm/node_modules/prismjs/components/prism-powershell.js +0 -60
- package/dist/esm/node_modules/prismjs/components/prism-python.js +0 -67
- package/dist/esm/node_modules/prismjs/components/prism-rust.js +0 -130
- package/dist/esm/node_modules/prismjs/components/prism-sql.js +0 -34
- package/dist/esm/node_modules/prismjs/components/prism-swift.js +0 -150
- package/dist/esm/node_modules/prismjs/components/prism-typescript.js +0 -62
- package/dist/esm/node_modules/prismjs/prism.js +0 -1951
- package/dist/esm/packages/lexical/src/components/StickyComponent.js +0 -221
- package/dist/esm/packages/lexical/src/nodes/StickyNode.js +0 -216
- package/dist/esm/packages/lexical/src/plugins/StickyPlugin.js +0 -20
- package/dist/types/components/StickyComponent.d.ts +0 -9
- package/dist/types/nodes/StickyNode.d.ts +0 -34
- package/dist/types/plugins/StickyPlugin.d.ts +0 -1
- package/src/components/StickyComponent.tsx +0 -271
- package/src/nodes/StickyNode.tsx +0 -249
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
import {
|
|
25
25
|
Button,
|
|
26
26
|
ButtonGroup,
|
|
27
|
-
CoreIcons,
|
|
28
27
|
Divider,
|
|
29
28
|
Dropdown,
|
|
30
29
|
Icon,
|
|
@@ -51,14 +50,14 @@ const blockTypeToBlockName: KeyValue = {
|
|
|
51
50
|
quote: "Quote",
|
|
52
51
|
};
|
|
53
52
|
const blockTypeToBlockIcon: KeyValue = {
|
|
54
|
-
bullet:
|
|
55
|
-
code:
|
|
53
|
+
bullet: "icon-[mdi--format-list-bulleted]",
|
|
54
|
+
code: "icon-[mdi--code-block-tags]",
|
|
56
55
|
h1: " ",
|
|
57
56
|
h2: " ",
|
|
58
57
|
paragraph: "",
|
|
59
|
-
h6:
|
|
60
|
-
number:
|
|
61
|
-
quote:
|
|
58
|
+
h6: "icon-[mdi--comment-text-outline]",
|
|
59
|
+
number: "icon-[mdi--format-list-numbered]",
|
|
60
|
+
quote: "icon-[mdi--format-quote-open]",
|
|
62
61
|
};
|
|
63
62
|
|
|
64
63
|
const SIZES = Object.freeze([
|
|
@@ -105,7 +104,7 @@ export const ToolbarPlugin = () => {
|
|
|
105
104
|
<Button
|
|
106
105
|
variant="link"
|
|
107
106
|
tabIndex={-1}
|
|
108
|
-
altIcon=
|
|
107
|
+
altIcon="icon-[mdi--menu-down]"
|
|
109
108
|
icon={blockTypeToBlockIcon[watch.blockType]}
|
|
110
109
|
>
|
|
111
110
|
{blockTypeToBlockName[watch.blockType]}
|
|
@@ -156,7 +155,7 @@ export const ToolbarPlugin = () => {
|
|
|
156
155
|
<Divider vertical />
|
|
157
156
|
<div>
|
|
158
157
|
<Dropdown>
|
|
159
|
-
<Button variant="link" altIcon={
|
|
158
|
+
<Button variant="link" altIcon="icon-[mdi--menu-down]" tabIndex={-1}>
|
|
160
159
|
{getValue(watch.fontSize + "", "16")}
|
|
161
160
|
</Button>
|
|
162
161
|
<Menu className="hide-icons">
|
|
@@ -176,7 +175,9 @@ export const ToolbarPlugin = () => {
|
|
|
176
175
|
<ButtonWrapper
|
|
177
176
|
value="start"
|
|
178
177
|
label={t("tool.alignStart")}
|
|
179
|
-
|
|
178
|
+
variant={watch.align === "start" ? "soft" : "link"}
|
|
179
|
+
color={watch.align === "start" ? "primary" : "default"}
|
|
180
|
+
icon={{ icon: "icon-[mdi--format-align-left]", rtlFlip: true }}
|
|
180
181
|
onClick={() =>
|
|
181
182
|
watch.activeEditor.dispatchCommand(FORMAT_ELEMENT_COMMAND, "start")
|
|
182
183
|
}
|
|
@@ -184,7 +185,9 @@ export const ToolbarPlugin = () => {
|
|
|
184
185
|
<ButtonWrapper
|
|
185
186
|
value="center"
|
|
186
187
|
label={t("tool.alignCenter")}
|
|
187
|
-
|
|
188
|
+
variant={watch.align === "center" ? "soft" : "link"}
|
|
189
|
+
color={watch.align === "center" ? "primary" : "default"}
|
|
190
|
+
icon="icon-[mdi--format-align-center]"
|
|
188
191
|
onClick={() =>
|
|
189
192
|
watch.activeEditor.dispatchCommand(FORMAT_ELEMENT_COMMAND, "center")
|
|
190
193
|
}
|
|
@@ -192,7 +195,9 @@ export const ToolbarPlugin = () => {
|
|
|
192
195
|
<ButtonWrapper
|
|
193
196
|
value="end"
|
|
194
197
|
label={t("tool.alignEnd")}
|
|
195
|
-
|
|
198
|
+
variant={watch.align === "end" ? "soft" : "link"}
|
|
199
|
+
color={watch.align === "end" ? "primary" : "default"}
|
|
200
|
+
icon={{ icon: "icon-[mdi--format-align-right]", rtlFlip: true }}
|
|
196
201
|
onClick={() =>
|
|
197
202
|
watch.activeEditor.dispatchCommand(FORMAT_ELEMENT_COMMAND, "end")
|
|
198
203
|
}
|
|
@@ -200,7 +205,9 @@ export const ToolbarPlugin = () => {
|
|
|
200
205
|
<ButtonWrapper
|
|
201
206
|
value="justify"
|
|
202
207
|
label={t("tool.alignJustify")}
|
|
203
|
-
|
|
208
|
+
variant={watch.align === "justify" ? "soft" : "link"}
|
|
209
|
+
color={watch.align === "justify" ? "primary" : "default"}
|
|
210
|
+
icon={{ icon: "icon-[mdi--format-align-justify]", rtlFlip: true }}
|
|
204
211
|
onClick={() =>
|
|
205
212
|
watch.activeEditor.dispatchCommand(
|
|
206
213
|
FORMAT_ELEMENT_COMMAND,
|
|
@@ -211,13 +218,13 @@ export const ToolbarPlugin = () => {
|
|
|
211
218
|
<ButtonWrapper
|
|
212
219
|
value="justify"
|
|
213
220
|
label={t("tool.indentOut")}
|
|
214
|
-
icon={{ icon:
|
|
221
|
+
icon={{ icon: "icon-[mdi--format-indent-decrease]", rtlFlip: true }}
|
|
215
222
|
onClick={() => watch.outdent()}
|
|
216
223
|
/>
|
|
217
224
|
<ButtonWrapper
|
|
218
225
|
value="justify"
|
|
219
|
-
label={t("tool.
|
|
220
|
-
icon={{ icon:
|
|
226
|
+
label={t("tool.indentIn")}
|
|
227
|
+
icon={{ icon: "icon-[mdi--format-indent-increase]", rtlFlip: true }}
|
|
221
228
|
onClick={() => watch.indent()}
|
|
222
229
|
/>
|
|
223
230
|
</ButtonGroup>
|
|
@@ -226,7 +233,8 @@ export const ToolbarPlugin = () => {
|
|
|
226
233
|
<ButtonWrapper
|
|
227
234
|
value="bold"
|
|
228
235
|
label={t("tool.bold")}
|
|
229
|
-
icon=
|
|
236
|
+
icon="icon-[mdi--format-bold]"
|
|
237
|
+
color={textFormat.includes("bold") ? "primary" : "default"}
|
|
230
238
|
onClick={() =>
|
|
231
239
|
watch.activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND, "bold")
|
|
232
240
|
}
|
|
@@ -234,7 +242,8 @@ export const ToolbarPlugin = () => {
|
|
|
234
242
|
<ButtonWrapper
|
|
235
243
|
value="italic"
|
|
236
244
|
label={t("tool.italic")}
|
|
237
|
-
icon=
|
|
245
|
+
icon="icon-[mdi--format-italic]"
|
|
246
|
+
color={textFormat.includes("italic") ? "primary" : "default"}
|
|
238
247
|
onClick={() =>
|
|
239
248
|
watch.activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND, "italic")
|
|
240
249
|
}
|
|
@@ -242,7 +251,8 @@ export const ToolbarPlugin = () => {
|
|
|
242
251
|
<ButtonWrapper
|
|
243
252
|
value="underline"
|
|
244
253
|
label={t("tool.underline")}
|
|
245
|
-
icon=
|
|
254
|
+
icon="icon-[mdi--format-underline]"
|
|
255
|
+
color={textFormat.includes("underline") ? "primary" : "default"}
|
|
246
256
|
onClick={() =>
|
|
247
257
|
watch.activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND, "underline")
|
|
248
258
|
}
|
|
@@ -250,7 +260,8 @@ export const ToolbarPlugin = () => {
|
|
|
250
260
|
<ButtonWrapper
|
|
251
261
|
value="strikethrough"
|
|
252
262
|
label={t("tool.strikethrough")}
|
|
253
|
-
icon=
|
|
263
|
+
icon="icon-[mdi--format-strikethrough-variant]"
|
|
264
|
+
color={textFormat.includes("strikethrough") ? "primary" : "default"}
|
|
254
265
|
onClick={() =>
|
|
255
266
|
watch.activeEditor.dispatchCommand(
|
|
256
267
|
FORMAT_TEXT_COMMAND,
|
|
@@ -264,24 +275,24 @@ export const ToolbarPlugin = () => {
|
|
|
264
275
|
{...{ noOutline: true }}
|
|
265
276
|
value={watch.fontColor}
|
|
266
277
|
onChange={(v) => watch.onFontColorSelect(v ?? undefined)}
|
|
267
|
-
decorateStart={<Icon icon=
|
|
278
|
+
decorateStart={<Icon icon="icon-[mdi--format-text]" />}
|
|
268
279
|
/>
|
|
269
280
|
<ColorInput
|
|
270
281
|
{...{ noOutline: true }}
|
|
271
282
|
value={watch.bgColor}
|
|
272
283
|
onChange={(v) => watch.onBgColorSelect(v ?? undefined)}
|
|
273
|
-
decorateStart={<Icon icon=
|
|
284
|
+
decorateStart={<Icon icon="icon-[mdi--format-color-fill]" />}
|
|
274
285
|
/>
|
|
275
286
|
<ButtonWrapper
|
|
276
287
|
value="hilight"
|
|
277
288
|
label={t("tool.hilight")}
|
|
278
|
-
icon=
|
|
289
|
+
icon="icon-[mdi--format-color-highlight]"
|
|
279
290
|
onClick={() => watch.onBgColorSelect("#fde68a")}
|
|
280
291
|
/>
|
|
281
292
|
<ButtonWrapper
|
|
282
293
|
value="hilight"
|
|
283
294
|
label={t("tool.clear")}
|
|
284
|
-
icon=
|
|
295
|
+
icon="icon-[mdi--format-clear]"
|
|
285
296
|
onClick={() => watch.clearFormatting()}
|
|
286
297
|
/>
|
|
287
298
|
</div>
|
|
@@ -1,474 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var LexicalHtml = require('../html/LexicalHtml.js');
|
|
4
|
-
var LexicalSelection = require('../selection/LexicalSelection.js');
|
|
5
|
-
var LexicalUtils = require('../utils/LexicalUtils.js');
|
|
6
|
-
var lexical = require('lexical');
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
10
|
-
*
|
|
11
|
-
* This source code is licensed under the MIT license found in the
|
|
12
|
-
* LICENSE file in the root directory of this source tree.
|
|
13
|
-
*
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
19
|
-
*
|
|
20
|
-
* This source code is licensed under the MIT license found in the
|
|
21
|
-
* LICENSE file in the root directory of this source tree.
|
|
22
|
-
*
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
// Do not require this module directly! Use normal `invariant` calls.
|
|
26
|
-
|
|
27
|
-
function formatDevErrorMessage(message) {
|
|
28
|
-
throw new Error(message);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Returns the *currently selected* Lexical content as an HTML string, relying on the
|
|
33
|
-
* logic defined in the exportDOM methods on the LexicalNode classes. Note that
|
|
34
|
-
* this will not return the HTML content of the entire editor (unless all the content is included
|
|
35
|
-
* in the current selection).
|
|
36
|
-
*
|
|
37
|
-
* @param editor - LexicalEditor instance to get HTML content from
|
|
38
|
-
* @param selection - The selection to use (default is $getSelection())
|
|
39
|
-
* @returns a string of HTML content
|
|
40
|
-
*/
|
|
41
|
-
function $getHtmlContent(editor, selection = lexical.$getSelection()) {
|
|
42
|
-
if (selection == null) {
|
|
43
|
-
{
|
|
44
|
-
formatDevErrorMessage(`Expected valid LexicalSelection`);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// If we haven't selected anything
|
|
49
|
-
if (lexical.$isRangeSelection(selection) && selection.isCollapsed() || selection.getNodes().length === 0) {
|
|
50
|
-
return '';
|
|
51
|
-
}
|
|
52
|
-
return LexicalHtml.$generateHtmlFromNodes(editor, selection);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Returns the *currently selected* Lexical content as a JSON string, relying on the
|
|
57
|
-
* logic defined in the exportJSON methods on the LexicalNode classes. Note that
|
|
58
|
-
* this will not return the JSON content of the entire editor (unless all the content is included
|
|
59
|
-
* in the current selection).
|
|
60
|
-
*
|
|
61
|
-
* @param editor - LexicalEditor instance to get the JSON content from
|
|
62
|
-
* @param selection - The selection to use (default is $getSelection())
|
|
63
|
-
* @returns
|
|
64
|
-
*/
|
|
65
|
-
function $getLexicalContent(editor, selection = lexical.$getSelection()) {
|
|
66
|
-
if (selection == null) {
|
|
67
|
-
{
|
|
68
|
-
formatDevErrorMessage(`Expected valid LexicalSelection`);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// If we haven't selected anything
|
|
73
|
-
if (lexical.$isRangeSelection(selection) && selection.isCollapsed() || selection.getNodes().length === 0) {
|
|
74
|
-
return null;
|
|
75
|
-
}
|
|
76
|
-
return JSON.stringify($generateJSONFromSelectedNodes(editor, selection));
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Attempts to insert content of the mime-types text/plain or text/uri-list from
|
|
81
|
-
* the provided DataTransfer object into the editor at the provided selection.
|
|
82
|
-
* text/uri-list is only used if text/plain is not also provided.
|
|
83
|
-
*
|
|
84
|
-
* @param dataTransfer an object conforming to the [DataTransfer interface] (https://html.spec.whatwg.org/multipage/dnd.html#the-datatransfer-interface)
|
|
85
|
-
* @param selection the selection to use as the insertion point for the content in the DataTransfer object
|
|
86
|
-
*/
|
|
87
|
-
function $insertDataTransferForPlainText(dataTransfer, selection) {
|
|
88
|
-
const text = dataTransfer.getData('text/plain') || dataTransfer.getData('text/uri-list');
|
|
89
|
-
if (text != null) {
|
|
90
|
-
selection.insertRawText(text);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Attempts to insert content of the mime-types application/x-lexical-editor, text/html,
|
|
96
|
-
* text/plain, or text/uri-list (in descending order of priority) from the provided DataTransfer
|
|
97
|
-
* object into the editor at the provided selection.
|
|
98
|
-
*
|
|
99
|
-
* @param dataTransfer an object conforming to the [DataTransfer interface] (https://html.spec.whatwg.org/multipage/dnd.html#the-datatransfer-interface)
|
|
100
|
-
* @param selection the selection to use as the insertion point for the content in the DataTransfer object
|
|
101
|
-
* @param editor the LexicalEditor the content is being inserted into.
|
|
102
|
-
*/
|
|
103
|
-
function $insertDataTransferForRichText(dataTransfer, selection, editor) {
|
|
104
|
-
const lexicalString = dataTransfer.getData('application/x-lexical-editor');
|
|
105
|
-
if (lexicalString) {
|
|
106
|
-
try {
|
|
107
|
-
const payload = JSON.parse(lexicalString);
|
|
108
|
-
if (payload.namespace === editor._config.namespace && Array.isArray(payload.nodes)) {
|
|
109
|
-
const nodes = $generateNodesFromSerializedNodes(payload.nodes);
|
|
110
|
-
return $insertGeneratedNodes(editor, nodes, selection);
|
|
111
|
-
}
|
|
112
|
-
} catch (_unused) {
|
|
113
|
-
// Fail silently.
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
const htmlString = dataTransfer.getData('text/html');
|
|
117
|
-
const plainString = dataTransfer.getData('text/plain');
|
|
118
|
-
|
|
119
|
-
// Skip HTML handling if it matches the plain text representation.
|
|
120
|
-
// This avoids unnecessary processing for plain text strings created by
|
|
121
|
-
// iOS Safari autocorrect, which incorrectly includes a `text/html` type.
|
|
122
|
-
if (htmlString && plainString !== htmlString) {
|
|
123
|
-
try {
|
|
124
|
-
const parser = new DOMParser();
|
|
125
|
-
const dom = parser.parseFromString(trustHTML(htmlString), 'text/html');
|
|
126
|
-
const nodes = LexicalHtml.$generateNodesFromDOM(editor, dom);
|
|
127
|
-
return $insertGeneratedNodes(editor, nodes, selection);
|
|
128
|
-
} catch (_unused2) {
|
|
129
|
-
// Fail silently.
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// Multi-line plain text in rich text mode pasted as separate paragraphs
|
|
134
|
-
// instead of single paragraph with linebreaks.
|
|
135
|
-
// Webkit-specific: Supports read 'text/uri-list' in clipboard.
|
|
136
|
-
const text = plainString || dataTransfer.getData('text/uri-list');
|
|
137
|
-
if (text != null) {
|
|
138
|
-
if (lexical.$isRangeSelection(selection)) {
|
|
139
|
-
const parts = text.split(/(\r?\n|\t)/);
|
|
140
|
-
if (parts[parts.length - 1] === '') {
|
|
141
|
-
parts.pop();
|
|
142
|
-
}
|
|
143
|
-
for (let i = 0; i < parts.length; i++) {
|
|
144
|
-
const currentSelection = lexical.$getSelection();
|
|
145
|
-
if (lexical.$isRangeSelection(currentSelection)) {
|
|
146
|
-
const part = parts[i];
|
|
147
|
-
if (part === '\n' || part === '\r\n') {
|
|
148
|
-
currentSelection.insertParagraph();
|
|
149
|
-
} else if (part === '\t') {
|
|
150
|
-
currentSelection.insertNodes([lexical.$createTabNode()]);
|
|
151
|
-
} else {
|
|
152
|
-
currentSelection.insertText(part);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
} else {
|
|
157
|
-
selection.insertRawText(text);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
function trustHTML(html) {
|
|
162
|
-
if (window.trustedTypes && window.trustedTypes.createPolicy) {
|
|
163
|
-
const policy = window.trustedTypes.createPolicy('lexical', {
|
|
164
|
-
createHTML: input => input
|
|
165
|
-
});
|
|
166
|
-
return policy.createHTML(html);
|
|
167
|
-
}
|
|
168
|
-
return html;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Inserts Lexical nodes into the editor using different strategies depending on
|
|
173
|
-
* some simple selection-based heuristics. If you're looking for a generic way to
|
|
174
|
-
* to insert nodes into the editor at a specific selection point, you probably want
|
|
175
|
-
* {@link lexical.$insertNodes}
|
|
176
|
-
*
|
|
177
|
-
* @param editor LexicalEditor instance to insert the nodes into.
|
|
178
|
-
* @param nodes The nodes to insert.
|
|
179
|
-
* @param selection The selection to insert the nodes into.
|
|
180
|
-
*/
|
|
181
|
-
function $insertGeneratedNodes(editor, nodes, selection) {
|
|
182
|
-
if (!editor.dispatchCommand(lexical.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND, {
|
|
183
|
-
nodes,
|
|
184
|
-
selection
|
|
185
|
-
})) {
|
|
186
|
-
selection.insertNodes(nodes);
|
|
187
|
-
$updateSelectionOnInsert(selection);
|
|
188
|
-
}
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
|
-
function $updateSelectionOnInsert(selection) {
|
|
192
|
-
if (lexical.$isRangeSelection(selection) && selection.isCollapsed()) {
|
|
193
|
-
const anchor = selection.anchor;
|
|
194
|
-
let nodeToInspect = null;
|
|
195
|
-
const anchorCaret = lexical.$caretFromPoint(anchor, 'previous');
|
|
196
|
-
if (anchorCaret) {
|
|
197
|
-
if (lexical.$isTextPointCaret(anchorCaret)) {
|
|
198
|
-
nodeToInspect = anchorCaret.origin;
|
|
199
|
-
} else {
|
|
200
|
-
const range = lexical.$getCaretRange(anchorCaret, lexical.$getChildCaret(lexical.$getRoot(), 'next').getFlipped());
|
|
201
|
-
for (const caret of range) {
|
|
202
|
-
if (lexical.$isTextNode(caret.origin)) {
|
|
203
|
-
nodeToInspect = caret.origin;
|
|
204
|
-
break;
|
|
205
|
-
} else if (lexical.$isElementNode(caret.origin) && !caret.origin.isInline()) {
|
|
206
|
-
break;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
if (nodeToInspect && lexical.$isTextNode(nodeToInspect)) {
|
|
212
|
-
const newFormat = nodeToInspect.getFormat();
|
|
213
|
-
const newStyle = nodeToInspect.getStyle();
|
|
214
|
-
if (selection.format !== newFormat || selection.style !== newStyle) {
|
|
215
|
-
selection.format = newFormat;
|
|
216
|
-
selection.style = newStyle;
|
|
217
|
-
selection.dirty = true;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
function exportNodeToJSON(node) {
|
|
223
|
-
const serializedNode = node.exportJSON();
|
|
224
|
-
const nodeClass = node.constructor;
|
|
225
|
-
if (serializedNode.type !== nodeClass.getType()) {
|
|
226
|
-
{
|
|
227
|
-
formatDevErrorMessage(`LexicalNode: Node ${nodeClass.name} does not implement .exportJSON().`);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
if (lexical.$isElementNode(node)) {
|
|
231
|
-
const serializedChildren = serializedNode.children;
|
|
232
|
-
if (!Array.isArray(serializedChildren)) {
|
|
233
|
-
{
|
|
234
|
-
formatDevErrorMessage(`LexicalNode: Node ${nodeClass.name} is an element but .exportJSON() does not have a children array.`);
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
return serializedNode;
|
|
239
|
-
}
|
|
240
|
-
function $appendNodesToJSON(editor, selection, currentNode, targetArray = []) {
|
|
241
|
-
let shouldInclude = selection !== null ? currentNode.isSelected(selection) : true;
|
|
242
|
-
const shouldExclude = lexical.$isElementNode(currentNode) && currentNode.excludeFromCopy('html');
|
|
243
|
-
let target = currentNode;
|
|
244
|
-
if (selection !== null) {
|
|
245
|
-
let clone = lexical.$cloneWithProperties(currentNode);
|
|
246
|
-
clone = lexical.$isTextNode(clone) && selection !== null ? LexicalSelection.$sliceSelectedTextNodeContent(selection, clone) : clone;
|
|
247
|
-
target = clone;
|
|
248
|
-
}
|
|
249
|
-
const children = lexical.$isElementNode(target) ? target.getChildren() : [];
|
|
250
|
-
const serializedNode = exportNodeToJSON(target);
|
|
251
|
-
|
|
252
|
-
// TODO: TextNode calls getTextContent() (NOT node.__text) within its exportJSON method
|
|
253
|
-
// which uses getLatest() to get the text from the original node with the same key.
|
|
254
|
-
// This is a deeper issue with the word "clone" here, it's still a reference to the
|
|
255
|
-
// same node as far as the LexicalEditor is concerned since it shares a key.
|
|
256
|
-
// We need a way to create a clone of a Node in memory with its own key, but
|
|
257
|
-
// until then this hack will work for the selected text extract use case.
|
|
258
|
-
if (lexical.$isTextNode(target)) {
|
|
259
|
-
const text = target.__text;
|
|
260
|
-
// If an uncollapsed selection ends or starts at the end of a line of specialized,
|
|
261
|
-
// TextNodes, such as code tokens, we will get a 'blank' TextNode here, i.e., one
|
|
262
|
-
// with text of length 0. We don't want this, it makes a confusing mess. Reset!
|
|
263
|
-
if (text.length > 0) {
|
|
264
|
-
serializedNode.text = text;
|
|
265
|
-
} else {
|
|
266
|
-
shouldInclude = false;
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
for (let i = 0; i < children.length; i++) {
|
|
270
|
-
const childNode = children[i];
|
|
271
|
-
const shouldIncludeChild = $appendNodesToJSON(editor, selection, childNode, serializedNode.children);
|
|
272
|
-
if (!shouldInclude && lexical.$isElementNode(currentNode) && shouldIncludeChild && currentNode.extractWithChild(childNode, selection, 'clone')) {
|
|
273
|
-
shouldInclude = true;
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
if (shouldInclude && !shouldExclude) {
|
|
277
|
-
targetArray.push(serializedNode);
|
|
278
|
-
} else if (Array.isArray(serializedNode.children)) {
|
|
279
|
-
for (let i = 0; i < serializedNode.children.length; i++) {
|
|
280
|
-
const serializedChildNode = serializedNode.children[i];
|
|
281
|
-
targetArray.push(serializedChildNode);
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
return shouldInclude;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
// TODO why $ function with Editor instance?
|
|
288
|
-
/**
|
|
289
|
-
* Gets the Lexical JSON of the nodes inside the provided Selection.
|
|
290
|
-
*
|
|
291
|
-
* @param editor LexicalEditor to get the JSON content from.
|
|
292
|
-
* @param selection Selection to get the JSON content from.
|
|
293
|
-
* @returns an object with the editor namespace and a list of serializable nodes as JavaScript objects.
|
|
294
|
-
*/
|
|
295
|
-
function $generateJSONFromSelectedNodes(editor, selection) {
|
|
296
|
-
const nodes = [];
|
|
297
|
-
const root = lexical.$getRoot();
|
|
298
|
-
const topLevelChildren = root.getChildren();
|
|
299
|
-
for (let i = 0; i < topLevelChildren.length; i++) {
|
|
300
|
-
const topLevelNode = topLevelChildren[i];
|
|
301
|
-
$appendNodesToJSON(editor, selection, topLevelNode, nodes);
|
|
302
|
-
}
|
|
303
|
-
return {
|
|
304
|
-
namespace: editor._config.namespace,
|
|
305
|
-
nodes
|
|
306
|
-
};
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
/**
|
|
310
|
-
* This method takes an array of objects conforming to the BaseSerializedNode interface and returns
|
|
311
|
-
* an Array containing instances of the corresponding LexicalNode classes registered on the editor.
|
|
312
|
-
* Normally, you'd get an Array of BaseSerialized nodes from {@link $generateJSONFromSelectedNodes}
|
|
313
|
-
*
|
|
314
|
-
* @param serializedNodes an Array of objects conforming to the BaseSerializedNode interface.
|
|
315
|
-
* @returns an Array of Lexical Node objects.
|
|
316
|
-
*/
|
|
317
|
-
function $generateNodesFromSerializedNodes(serializedNodes) {
|
|
318
|
-
const nodes = [];
|
|
319
|
-
for (let i = 0; i < serializedNodes.length; i++) {
|
|
320
|
-
const serializedNode = serializedNodes[i];
|
|
321
|
-
const node = lexical.$parseSerializedNode(serializedNode);
|
|
322
|
-
if (lexical.$isTextNode(node)) {
|
|
323
|
-
LexicalSelection.$addNodeStyle(node);
|
|
324
|
-
}
|
|
325
|
-
nodes.push(node);
|
|
326
|
-
}
|
|
327
|
-
return nodes;
|
|
328
|
-
}
|
|
329
|
-
const EVENT_LATENCY = 50;
|
|
330
|
-
let clipboardEventTimeout = null;
|
|
331
|
-
|
|
332
|
-
// TODO custom selection
|
|
333
|
-
// TODO potentially have a node customizable version for plain text
|
|
334
|
-
/**
|
|
335
|
-
* Copies the content of the current selection to the clipboard in
|
|
336
|
-
* text/plain, text/html, and application/x-lexical-editor (Lexical JSON)
|
|
337
|
-
* formats.
|
|
338
|
-
*
|
|
339
|
-
* @param editor the LexicalEditor instance to copy content from
|
|
340
|
-
* @param event the native browser ClipboardEvent to add the content to.
|
|
341
|
-
* @returns
|
|
342
|
-
*/
|
|
343
|
-
async function copyToClipboard(editor, event, data) {
|
|
344
|
-
if (clipboardEventTimeout !== null) {
|
|
345
|
-
// Prevent weird race conditions that can happen when this function is run multiple times
|
|
346
|
-
// synchronously. In the future, we can do better, we can cancel/override the previously running job.
|
|
347
|
-
return false;
|
|
348
|
-
}
|
|
349
|
-
if (event !== null) {
|
|
350
|
-
return new Promise((resolve, reject) => {
|
|
351
|
-
editor.update(() => {
|
|
352
|
-
resolve($copyToClipboardEvent(editor, event, data));
|
|
353
|
-
});
|
|
354
|
-
});
|
|
355
|
-
}
|
|
356
|
-
const rootElement = editor.getRootElement();
|
|
357
|
-
const editorWindow = editor._window || window;
|
|
358
|
-
const windowDocument = window.document;
|
|
359
|
-
const domSelection = lexical.getDOMSelection(editorWindow);
|
|
360
|
-
if (rootElement === null || domSelection === null) {
|
|
361
|
-
return false;
|
|
362
|
-
}
|
|
363
|
-
const element = windowDocument.createElement('span');
|
|
364
|
-
element.style.cssText = 'position: fixed; top: -1000px;';
|
|
365
|
-
element.append(windowDocument.createTextNode('#'));
|
|
366
|
-
rootElement.append(element);
|
|
367
|
-
const range = new Range();
|
|
368
|
-
range.setStart(element, 0);
|
|
369
|
-
range.setEnd(element, 1);
|
|
370
|
-
domSelection.removeAllRanges();
|
|
371
|
-
domSelection.addRange(range);
|
|
372
|
-
return new Promise((resolve, reject) => {
|
|
373
|
-
const removeListener = editor.registerCommand(lexical.COPY_COMMAND, secondEvent => {
|
|
374
|
-
if (LexicalUtils.objectKlassEquals(secondEvent, ClipboardEvent)) {
|
|
375
|
-
removeListener();
|
|
376
|
-
if (clipboardEventTimeout !== null) {
|
|
377
|
-
window.clearTimeout(clipboardEventTimeout);
|
|
378
|
-
clipboardEventTimeout = null;
|
|
379
|
-
}
|
|
380
|
-
resolve($copyToClipboardEvent(editor, secondEvent, data));
|
|
381
|
-
}
|
|
382
|
-
// Block the entire copy flow while we wait for the next ClipboardEvent
|
|
383
|
-
return true;
|
|
384
|
-
}, lexical.COMMAND_PRIORITY_CRITICAL);
|
|
385
|
-
// If the above hack execCommand hack works, this timeout code should never fire. Otherwise,
|
|
386
|
-
// the listener will be quickly freed so that the user can reuse it again
|
|
387
|
-
clipboardEventTimeout = window.setTimeout(() => {
|
|
388
|
-
removeListener();
|
|
389
|
-
clipboardEventTimeout = null;
|
|
390
|
-
resolve(false);
|
|
391
|
-
}, EVENT_LATENCY);
|
|
392
|
-
windowDocument.execCommand('copy');
|
|
393
|
-
element.remove();
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
// TODO shouldn't pass editor (pass namespace directly)
|
|
398
|
-
function $copyToClipboardEvent(editor, event, data) {
|
|
399
|
-
if (data === undefined) {
|
|
400
|
-
const domSelection = lexical.getDOMSelection(editor._window);
|
|
401
|
-
if (!domSelection) {
|
|
402
|
-
return false;
|
|
403
|
-
}
|
|
404
|
-
const anchorDOM = domSelection.anchorNode;
|
|
405
|
-
const focusDOM = domSelection.focusNode;
|
|
406
|
-
if (anchorDOM !== null && focusDOM !== null && !lexical.isSelectionWithinEditor(editor, anchorDOM, focusDOM)) {
|
|
407
|
-
return false;
|
|
408
|
-
}
|
|
409
|
-
const selection = lexical.$getSelection();
|
|
410
|
-
if (selection === null) {
|
|
411
|
-
return false;
|
|
412
|
-
}
|
|
413
|
-
data = $getClipboardDataFromSelection(selection);
|
|
414
|
-
}
|
|
415
|
-
event.preventDefault();
|
|
416
|
-
const clipboardData = event.clipboardData;
|
|
417
|
-
if (clipboardData === null) {
|
|
418
|
-
return false;
|
|
419
|
-
}
|
|
420
|
-
setLexicalClipboardDataTransfer(clipboardData, data);
|
|
421
|
-
return true;
|
|
422
|
-
}
|
|
423
|
-
const clipboardDataFunctions = [['text/html', $getHtmlContent], ['application/x-lexical-editor', $getLexicalContent]];
|
|
424
|
-
|
|
425
|
-
/**
|
|
426
|
-
* Serialize the content of the current selection to strings in
|
|
427
|
-
* text/plain, text/html, and application/x-lexical-editor (Lexical JSON)
|
|
428
|
-
* formats (as available).
|
|
429
|
-
*
|
|
430
|
-
* @param selection the selection to serialize (defaults to $getSelection())
|
|
431
|
-
* @returns LexicalClipboardData
|
|
432
|
-
*/
|
|
433
|
-
function $getClipboardDataFromSelection(selection = lexical.$getSelection()) {
|
|
434
|
-
const clipboardData = {
|
|
435
|
-
'text/plain': selection ? selection.getTextContent() : ''
|
|
436
|
-
};
|
|
437
|
-
if (selection) {
|
|
438
|
-
const editor = lexical.$getEditor();
|
|
439
|
-
for (const [mimeType, $editorFn] of clipboardDataFunctions) {
|
|
440
|
-
const v = $editorFn(editor, selection);
|
|
441
|
-
if (v !== null) {
|
|
442
|
-
clipboardData[mimeType] = v;
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
return clipboardData;
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
/**
|
|
450
|
-
* Call setData on the given clipboardData for each MIME type present
|
|
451
|
-
* in the given data (from {@link $getClipboardDataFromSelection})
|
|
452
|
-
*
|
|
453
|
-
* @param clipboardData the event.clipboardData to populate from data
|
|
454
|
-
* @param data The lexical data
|
|
455
|
-
*/
|
|
456
|
-
function setLexicalClipboardDataTransfer(clipboardData, data) {
|
|
457
|
-
for (const k in data) {
|
|
458
|
-
const v = data[k];
|
|
459
|
-
if (v !== undefined) {
|
|
460
|
-
clipboardData.setData(k, v);
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
exports.$generateJSONFromSelectedNodes = $generateJSONFromSelectedNodes;
|
|
466
|
-
exports.$generateNodesFromSerializedNodes = $generateNodesFromSerializedNodes;
|
|
467
|
-
exports.$getClipboardDataFromSelection = $getClipboardDataFromSelection;
|
|
468
|
-
exports.$getHtmlContent = $getHtmlContent;
|
|
469
|
-
exports.$getLexicalContent = $getLexicalContent;
|
|
470
|
-
exports.$insertDataTransferForPlainText = $insertDataTransferForPlainText;
|
|
471
|
-
exports.$insertDataTransferForRichText = $insertDataTransferForRichText;
|
|
472
|
-
exports.$insertGeneratedNodes = $insertGeneratedNodes;
|
|
473
|
-
exports.copyToClipboard = copyToClipboard;
|
|
474
|
-
exports.setLexicalClipboardDataTransfer = setLexicalClipboardDataTransfer;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var LexicalClipboard_dev = require('./LexicalClipboard.dev.js');
|
|
4
|
-
var LexicalClipboard_prod = require('./LexicalClipboard.prod.js');
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the MIT license found in the
|
|
10
|
-
* LICENSE file in the root directory of this source tree.
|
|
11
|
-
*
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
const mod = process.env.NODE_ENV !== 'production' ? LexicalClipboard_dev : LexicalClipboard_prod;
|
|
15
|
-
const $getClipboardDataFromSelection = mod.$getClipboardDataFromSelection;
|
|
16
|
-
const $insertDataTransferForRichText = mod.$insertDataTransferForRichText;
|
|
17
|
-
const copyToClipboard = mod.copyToClipboard;
|
|
18
|
-
|
|
19
|
-
exports.$getClipboardDataFromSelection = $getClipboardDataFromSelection;
|
|
20
|
-
exports.$insertDataTransferForRichText = $insertDataTransferForRichText;
|
|
21
|
-
exports.copyToClipboard = copyToClipboard;
|