@comet/cms-admin 9.0.0-beta.3 → 9.0.0-beta.5
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/lib/blocks/PixelImageBlock.d.ts.map +1 -1
- package/lib/blocks/PixelImageBlock.fragment.d.ts +2 -0
- package/lib/blocks/PixelImageBlock.fragment.d.ts.map +1 -0
- package/lib/blocks/PixelImageBlock.fragment.generated.d.ts +20 -0
- package/lib/blocks/PixelImageBlock.fragment.generated.d.ts.map +1 -0
- package/lib/blocks/PixelImageBlock.fragment.generated.js +5 -0
- package/lib/blocks/PixelImageBlock.fragment.js +4 -0
- package/lib/blocks/PixelImageBlock.js +3 -2
- package/lib/blocks/__stories__/BlockInFinalForm.stories.js +53 -0
- package/lib/blocks/__stories__/RichTextBlock.stories.js +53 -0
- package/lib/blocks/createLinkBlock.d.ts.map +1 -1
- package/lib/blocks/createLinkBlock.js +50 -1
- package/lib/blocks/createRichTextBlock.d.ts.map +1 -1
- package/lib/blocks/createRichTextBlock.js +56 -20
- package/lib/blocks/createSeoBlock.d.ts.map +1 -1
- package/lib/blocks/createSeoBlock.js +6 -4
- package/lib/blocks/createTextLinkBlock.d.ts.map +1 -1
- package/lib/blocks/createTextLinkBlock.js +36 -1
- package/lib/blocks/factories/createBlocksBlock.d.ts.map +1 -1
- package/lib/blocks/factories/createBlocksBlock.js +70 -13
- package/lib/blocks/factories/createColumnsBlock.d.ts.map +1 -1
- package/lib/blocks/factories/createColumnsBlock.js +56 -6
- package/lib/blocks/factories/createListBlock.d.ts.map +1 -1
- package/lib/blocks/factories/createListBlock.js +56 -6
- package/lib/blocks/factories/createOneOfBlock.d.ts.map +1 -1
- package/lib/blocks/factories/createOneOfBlock.js +62 -5
- package/lib/blocks/factories/createOptionalBlock.d.ts.map +1 -1
- package/lib/blocks/factories/createOptionalBlock.js +38 -1
- package/lib/blocks/helpers/__stories__/createCompositeBlockSelectField.stories.js +106 -0
- package/lib/blocks/helpers/composeBlocks/composeBlocks.d.ts.map +1 -1
- package/lib/blocks/helpers/composeBlocks/composeBlocks.js +52 -16
- package/lib/blocks/helpers/composeBlocks/createCompositeBlockField.d.ts +2 -1
- package/lib/blocks/helpers/composeBlocks/createCompositeBlockField.d.ts.map +1 -1
- package/lib/blocks/helpers/composeBlocks/createCompositeBlockField.js +4 -2
- package/lib/blocks/helpers/composeBlocks/createSettingsBlock.d.ts +2 -1
- package/lib/blocks/helpers/composeBlocks/createSettingsBlock.d.ts.map +1 -1
- package/lib/blocks/helpers/composeBlocks/createSettingsBlock.js +5 -1
- package/lib/blocks/helpers/createBlockSkeleton.js +15 -1
- package/lib/blocks/helpers/createCompositeBlockTextField.d.ts +2 -1
- package/lib/blocks/helpers/createCompositeBlockTextField.d.ts.map +1 -1
- package/lib/blocks/helpers/createCompositeBlockTextField.js +20 -2
- package/lib/blocks/table/TableBlockGrid.d.ts.map +1 -1
- package/lib/blocks/table/TableBlockGrid.js +3 -1
- package/lib/blocks/table/utils/column.d.ts +16 -21
- package/lib/blocks/table/utils/column.d.ts.map +1 -1
- package/lib/blocks/table/utils/column.js +0 -11
- package/lib/blocks/table/utils/getClipboardValueForSchema.d.ts +1 -1
- package/lib/blocks/table/utils/getClipboardValueForSchema.d.ts.map +1 -1
- package/lib/blocks/table/utils/row.d.ts +3 -18
- package/lib/blocks/table/utils/row.d.ts.map +1 -1
- package/lib/blocks/table/utils/row.js +1 -1
- package/lib/blocks/table/utils/rteSchema.d.ts +1 -5
- package/lib/blocks/table/utils/rteSchema.d.ts.map +1 -1
- package/lib/blocks/tipTap/BlockStyleContext.d.ts +3 -0
- package/lib/blocks/tipTap/BlockStyleContext.d.ts.map +1 -0
- package/lib/blocks/tipTap/BlockStyleContext.js +2 -0
- package/lib/blocks/tipTap/InlineStyleContext.d.ts +3 -0
- package/lib/blocks/tipTap/InlineStyleContext.d.ts.map +1 -0
- package/lib/blocks/tipTap/InlineStyleContext.js +2 -0
- package/lib/blocks/tipTap/TipTapLinkDialog.d.ts +10 -0
- package/lib/blocks/tipTap/TipTapLinkDialog.d.ts.map +1 -0
- package/lib/blocks/tipTap/TipTapLinkDialog.js +105 -0
- package/lib/blocks/tipTap/TipTapToolbar.d.ts +13 -0
- package/lib/blocks/tipTap/TipTapToolbar.d.ts.map +1 -0
- package/lib/blocks/tipTap/TipTapToolbar.js +666 -0
- package/lib/blocks/tipTap/__stories__/TipTapRichTextBlock.stories.js +1841 -0
- package/lib/blocks/tipTap/createTipTapRichTextBlock.d.ts +61 -0
- package/lib/blocks/tipTap/createTipTapRichTextBlock.d.ts.map +1 -0
- package/lib/blocks/tipTap/createTipTapRichTextBlock.js +424 -0
- package/lib/blocks/tipTap/extensions/BlockStyleHeading.d.ts +2 -0
- package/lib/blocks/tipTap/extensions/BlockStyleHeading.d.ts.map +1 -0
- package/lib/blocks/tipTap/extensions/BlockStyleHeading.js +57 -0
- package/lib/blocks/tipTap/extensions/BlockStyleParagraph.d.ts +2 -0
- package/lib/blocks/tipTap/extensions/BlockStyleParagraph.d.ts.map +1 -0
- package/lib/blocks/tipTap/extensions/BlockStyleParagraph.js +56 -0
- package/lib/blocks/tipTap/extensions/CmsLink.d.ts +13 -0
- package/lib/blocks/tipTap/extensions/CmsLink.d.ts.map +1 -0
- package/lib/blocks/tipTap/extensions/CmsLink.js +42 -0
- package/lib/blocks/tipTap/extensions/InlineStyleMark.d.ts +13 -0
- package/lib/blocks/tipTap/extensions/InlineStyleMark.d.ts.map +1 -0
- package/lib/blocks/tipTap/extensions/InlineStyleMark.js +71 -0
- package/lib/blocks/tipTap/extensions/NonBreakingSpace.d.ts +10 -0
- package/lib/blocks/tipTap/extensions/NonBreakingSpace.d.ts.map +1 -0
- package/lib/blocks/tipTap/extensions/NonBreakingSpace.js +57 -0
- package/lib/blocks/tipTap/extensions/Placeholder.d.ts +10 -0
- package/lib/blocks/tipTap/extensions/Placeholder.d.ts.map +1 -0
- package/lib/blocks/tipTap/extensions/Placeholder.js +78 -0
- package/lib/blocks/tipTap/extensions/SoftHyphen.d.ts +10 -0
- package/lib/blocks/tipTap/extensions/SoftHyphen.d.ts.map +1 -0
- package/lib/blocks/tipTap/extensions/SoftHyphen.js +51 -0
- package/lib/blocks/tipTap/listLevelMaxHelpers.d.ts +6 -0
- package/lib/blocks/tipTap/listLevelMaxHelpers.d.ts.map +1 -0
- package/lib/blocks/tipTap/listLevelMaxHelpers.js +108 -0
- package/lib/blocks/types.d.ts +7 -0
- package/lib/blocks/types.d.ts.map +1 -1
- package/lib/builds/PublisherPage.js +2 -2
- package/lib/builds/StartBuildsDialog.d.ts.map +1 -1
- package/lib/builds/StartBuildsDialog.js +1 -1
- package/lib/common/__stories__/MasterMenuInMasterLayout.stories.js +87 -0
- package/lib/config/CometConfigContext.d.ts +8 -1
- package/lib/config/CometConfigContext.d.ts.map +1 -1
- package/lib/config/CometConfigContext.js +9 -5
- package/lib/contentScope/__stories__/ContentScopeProvider.stories.js +85 -0
- package/lib/contentScope/__stories__/ContentScopeSelect.stories.js +655 -0
- package/lib/contentScope/noContentScopeFallback/__stories__/NoContentScopeFallback.stories.js +7 -0
- package/lib/cronJobs/CronJobsGrid.js +1 -1
- package/lib/cronJobs/JobsGrid.js +1 -1
- package/lib/dam/DamTable.d.ts +5 -1
- package/lib/dam/DamTable.d.ts.map +1 -1
- package/lib/dam/DamTable.js +5 -1
- package/lib/dam/DataGrid/FolderDataGrid.d.ts +1 -1
- package/lib/dam/DataGrid/FolderDataGrid.d.ts.map +1 -1
- package/lib/dam/DataGrid/FolderDataGrid.js +58 -47
- package/lib/dam/DataGrid/selection/DamSelectionContext.d.ts +7 -4
- package/lib/dam/DataGrid/selection/DamSelectionContext.d.ts.map +1 -1
- package/lib/dam/DataGrid/selection/DamSelectionContext.js +11 -3
- package/lib/dam/FileForm/EditFile.d.ts.map +1 -1
- package/lib/dam/FileForm/EditFile.js +5 -2
- package/lib/dam/mediaAlternatives/MediaAlternativesGrid.d.ts.map +1 -1
- package/lib/dam/mediaAlternatives/MediaAlternativesGrid.js +1 -1
- package/lib/dashboard/widgets/LatestBuildsDashboardWidget.js +1 -1
- package/lib/dashboard/widgets/LatestContentUpdatesDashboardWidget.d.ts +1 -1
- package/lib/dashboard/widgets/LatestContentUpdatesDashboardWidget.d.ts.map +1 -1
- package/lib/dashboard/widgets/LatestContentUpdatesDashboardWidget.js +1 -1
- package/lib/dashboard/widgets/__stories__/DashboardWidgetRoot.stories.js +82 -0
- package/lib/dataGrid/DataGrid.d.ts +3 -0
- package/lib/dataGrid/DataGrid.d.ts.map +1 -0
- package/lib/dataGrid/DataGrid.js +19 -0
- package/lib/dependencies/DependenciesList.d.ts.map +1 -1
- package/lib/dependencies/DependenciesList.js +1 -1
- package/lib/dependencies/DependentsList.d.ts.map +1 -1
- package/lib/dependencies/DependentsList.js +1 -1
- package/lib/form/file/FileField.d.ts +15 -12
- package/lib/form/file/FileField.d.ts.map +1 -1
- package/lib/form/file/FileField.gql.d.ts +2 -0
- package/lib/form/file/FileField.gql.d.ts.map +1 -1
- package/lib/form/file/FileField.gql.generated.d.ts +40 -0
- package/lib/form/file/FileField.gql.generated.d.ts.map +1 -1
- package/lib/form/file/FileField.gql.generated.js +2 -1
- package/lib/form/file/FileField.gql.js +6 -3
- package/lib/form/file/FileField.js +170 -86
- package/lib/form/file/FileFieldMenu.d.ts +17 -0
- package/lib/form/file/FileFieldMenu.d.ts.map +1 -0
- package/lib/form/file/FileFieldMenu.js +91 -0
- package/lib/form/file/FileFieldRow.d.ts +12 -0
- package/lib/form/file/FileFieldRow.d.ts.map +1 -0
- package/lib/form/file/FileFieldRow.js +96 -0
- package/lib/form/file/__stories__/FileUploadField.stories.js +351 -0
- package/lib/form/file/chooseFile/BaseChooseDamFileDialog.d.ts +20 -0
- package/lib/form/file/chooseFile/BaseChooseDamFileDialog.d.ts.map +1 -0
- package/lib/form/file/chooseFile/BaseChooseDamFileDialog.js +106 -0
- package/lib/form/file/chooseFile/ChooseDamFileDialog.d.ts.map +1 -1
- package/lib/form/file/chooseFile/ChooseDamFileDialog.js +34 -89
- package/lib/form/file/chooseFile/ChooseDamFilesDialog.d.ts +9 -0
- package/lib/form/file/chooseFile/ChooseDamFilesDialog.d.ts.map +1 -0
- package/lib/form/file/chooseFile/ChooseDamFilesDialog.js +117 -0
- package/lib/graphql.generated.d.ts +19 -1
- package/lib/graphql.generated.d.ts.map +1 -1
- package/lib/index.d.ts +10 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +7 -0
- package/lib/pages/createEditPageNode.d.ts.map +1 -1
- package/lib/pages/createEditPageNode.js +1 -12
- package/lib/pages/createUsePage.d.ts +1 -0
- package/lib/pages/createUsePage.d.ts.map +1 -1
- package/lib/pages/createUsePage.js +135 -6
- package/lib/pages/pageTree/PageActions.d.ts.map +1 -1
- package/lib/pages/pageTree/PageActions.js +21 -3
- package/lib/pages/pageTree/findAvailableSlug.d.ts +11 -0
- package/lib/pages/pageTree/findAvailableSlug.d.ts.map +1 -0
- package/lib/pages/pageTree/findAvailableSlug.generated.d.ts +16 -0
- package/lib/pages/pageTree/findAvailableSlug.generated.d.ts.map +1 -0
- package/lib/pages/pageTree/findAvailableSlug.generated.js +5 -0
- package/lib/pages/pageTree/findAvailableSlug.js +62 -0
- package/lib/pages/pageTree/transformToSlug.d.ts +2 -0
- package/lib/pages/pageTree/transformToSlug.d.ts.map +1 -0
- package/lib/pages/pageTree/transformToSlug.js +12 -0
- package/lib/pages/pageTree/useCopyPastePages/sendPages.d.ts.map +1 -1
- package/lib/pages/pageTree/useCopyPastePages/sendPages.generated.d.ts +0 -10
- package/lib/pages/pageTree/useCopyPastePages/sendPages.generated.d.ts.map +1 -1
- package/lib/pages/pageTree/useCopyPastePages/sendPages.generated.js +0 -1
- package/lib/pages/pageTree/useCopyPastePages/sendPages.js +19 -40
- package/lib/pages/pageTree/useCopyPastePages.d.ts.map +1 -1
- package/lib/pages/pageTree/useCopyPastePages.js +1 -1
- package/lib/pages/pageTree/{useCopyPastePages/ProgressDialog.d.ts → useProgressDialog.d.ts} +1 -1
- package/lib/pages/pageTree/useProgressDialog.d.ts.map +1 -0
- package/lib/pages/pageTree/useTranslatePagesAction.d.ts +16 -0
- package/lib/pages/pageTree/useTranslatePagesAction.d.ts.map +1 -0
- package/lib/pages/pageTree/useTranslatePagesAction.generated.d.ts +20 -0
- package/lib/pages/pageTree/useTranslatePagesAction.generated.d.ts.map +1 -0
- package/lib/pages/pageTree/useTranslatePagesAction.generated.js +5 -0
- package/lib/pages/pageTree/useTranslatePagesAction.js +339 -0
- package/lib/pages/pagesPage/PagesPageActionToolbar.d.ts.map +1 -1
- package/lib/pages/pagesPage/PagesPageActionToolbar.js +29 -2
- package/lib/pages/pagesPage/PagesPageActionToolbar.sc.d.ts +2 -2
- package/lib/redirects/RedirectsGrid.d.ts +1 -1
- package/lib/redirects/RedirectsGrid.d.ts.map +1 -1
- package/lib/redirects/RedirectsGrid.gql.d.ts +1 -0
- package/lib/redirects/RedirectsGrid.gql.d.ts.map +1 -1
- package/lib/redirects/RedirectsGrid.gql.generated.d.ts +8 -0
- package/lib/redirects/RedirectsGrid.gql.generated.d.ts.map +1 -1
- package/lib/redirects/RedirectsGrid.gql.generated.js +2 -1
- package/lib/redirects/RedirectsGrid.gql.js +3 -2
- package/lib/redirects/RedirectsGrid.js +107 -15
- package/lib/translation/AzureAiTranslatorProvider.d.ts +1 -1
- package/lib/translation/AzureAiTranslatorProvider.d.ts.map +1 -1
- package/lib/translation/AzureAiTranslatorProvider.generated.d.ts +8 -0
- package/lib/translation/AzureAiTranslatorProvider.generated.d.ts.map +1 -1
- package/lib/translation/AzureAiTranslatorProvider.generated.js +2 -1
- package/lib/translation/AzureAiTranslatorProvider.js +31 -2
- package/lib/translation/TranslatableInterface.d.ts +4 -0
- package/lib/translation/TranslatableInterface.d.ts.map +1 -0
- package/lib/translation/TranslatableInterface.js +1 -0
- package/lib/translation/TranslateContentMenuItem.d.ts +7 -0
- package/lib/translation/TranslateContentMenuItem.d.ts.map +1 -0
- package/lib/translation/TranslateContentMenuItem.js +99 -0
- package/lib/translation/createDocumentTranslationMethods.d.ts +4 -0
- package/lib/translation/createDocumentTranslationMethods.d.ts.map +1 -0
- package/lib/translation/createDocumentTranslationMethods.js +62 -0
- package/lib/userPermissions/UserGrid.d.ts +1 -1
- package/lib/userPermissions/UserGrid.d.ts.map +1 -1
- package/lib/userPermissions/UserGrid.js +2 -2
- package/lib/userPermissions/user/permissions/ContentScopeGrid.d.ts.map +1 -1
- package/lib/userPermissions/user/permissions/ContentScopeGrid.js +1 -1
- package/lib/userPermissions/user/permissions/OverrideContentScopesDialog.js +1 -1
- package/lib/userPermissions/user/permissions/PermissionGrid.d.ts.map +1 -1
- package/lib/userPermissions/user/permissions/PermissionGrid.js +1 -1
- package/lib/userPermissions/user/permissions/selectScopesDialogContent/SelectScopesDialogContent.d.ts.map +1 -1
- package/lib/userPermissions/user/permissions/selectScopesDialogContent/SelectScopesDialogContent.js +1 -1
- package/lib/validation/validateJson.d.ts +2 -0
- package/lib/validation/validateJson.d.ts.map +1 -0
- package/lib/validation/validateJson.js +15 -0
- package/lib/warnings/LatestWarningsDashboardWidget.js +1 -1
- package/lib/warnings/WarningsGrid.d.ts.map +1 -1
- package/lib/warnings/WarningsGrid.js +1 -1
- package/package.json +36 -26
- package/lib/dashboard/__stories__/DateTime.stories.d.ts +0 -7
- package/lib/dashboard/__stories__/DateTime.stories.d.ts.map +0 -1
- package/lib/pages/pageTree/useCopyPastePages/ProgressDialog.d.ts.map +0 -1
- /package/lib/pages/pageTree/{useCopyPastePages/ProgressDialog.js → useProgressDialog.js} +0 -0
|
@@ -0,0 +1,1841 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
8
|
+
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
9
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
10
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
11
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
12
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
14
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
15
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
16
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
17
|
+
import { Box, chipClasses, Typography } from "@mui/material";
|
|
18
|
+
import { useState } from "react";
|
|
19
|
+
import { expect, waitFor, within } from "storybook/test";
|
|
20
|
+
import { createTipTapRichTextBlock } from "../createTipTapRichTextBlock";
|
|
21
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
|
+
function StatePreview(_ref) {
|
|
23
|
+
var state = _ref.state;
|
|
24
|
+
return /*#__PURE__*/_jsx(Box, {
|
|
25
|
+
component: "pre",
|
|
26
|
+
sx: {
|
|
27
|
+
mt: 2,
|
|
28
|
+
p: 2,
|
|
29
|
+
backgroundColor: "#f5f5f5",
|
|
30
|
+
fontSize: 12,
|
|
31
|
+
overflow: "auto",
|
|
32
|
+
borderRadius: 1
|
|
33
|
+
},
|
|
34
|
+
children: JSON.stringify(state, null, 2)
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function StoryWrapper(_ref2) {
|
|
38
|
+
var children = _ref2.children,
|
|
39
|
+
state = _ref2.state;
|
|
40
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
41
|
+
children: [children, /*#__PURE__*/_jsx(StatePreview, {
|
|
42
|
+
state: state
|
|
43
|
+
})]
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
var TipTapRichTextBlock = createTipTapRichTextBlock();
|
|
47
|
+
function TipTapRichTextBlockStory() {
|
|
48
|
+
var _useState = useState(TipTapRichTextBlock.defaultValues()),
|
|
49
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
50
|
+
state = _useState2[0],
|
|
51
|
+
setState = _useState2[1];
|
|
52
|
+
return /*#__PURE__*/_jsx(StoryWrapper, {
|
|
53
|
+
state: state,
|
|
54
|
+
children: /*#__PURE__*/_jsx(TipTapRichTextBlock.AdminComponent, {
|
|
55
|
+
state: state,
|
|
56
|
+
updateState: setState
|
|
57
|
+
})
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
var config = {
|
|
61
|
+
component: TipTapRichTextBlockStory,
|
|
62
|
+
title: "blocks/TipTapRichTextBlock"
|
|
63
|
+
};
|
|
64
|
+
export default config;
|
|
65
|
+
export var Default = {
|
|
66
|
+
play: function () {
|
|
67
|
+
var _play = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(_ref3) {
|
|
68
|
+
var canvas, step;
|
|
69
|
+
return _regenerator().w(function (_context3) {
|
|
70
|
+
while (1) switch (_context3.n) {
|
|
71
|
+
case 0:
|
|
72
|
+
canvas = _ref3.canvas, step = _ref3.step;
|
|
73
|
+
_context3.n = 1;
|
|
74
|
+
return step("Editor is ready with toolbar", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
75
|
+
var buttons;
|
|
76
|
+
return _regenerator().w(function (_context) {
|
|
77
|
+
while (1) switch (_context.n) {
|
|
78
|
+
case 0:
|
|
79
|
+
_context.n = 1;
|
|
80
|
+
return waitFor(function () {
|
|
81
|
+
expect(canvas.getByRole("textbox")).toBeInTheDocument();
|
|
82
|
+
}, {
|
|
83
|
+
timeout: 5000
|
|
84
|
+
});
|
|
85
|
+
case 1:
|
|
86
|
+
// Heading select shows "Default"
|
|
87
|
+
expect(canvas.getByRole("combobox")).toBeInTheDocument();
|
|
88
|
+
expect(canvas.getByText("Default")).toBeInTheDocument();
|
|
89
|
+
|
|
90
|
+
// Toolbar has buttons (undo, redo, bold, italic, strike, more, ol, ul, indent, dedent, nbsp, shy)
|
|
91
|
+
buttons = canvas.getAllByRole("button");
|
|
92
|
+
expect(buttons.length).toBeGreaterThanOrEqual(10);
|
|
93
|
+
case 2:
|
|
94
|
+
return _context.a(2);
|
|
95
|
+
}
|
|
96
|
+
}, _callee);
|
|
97
|
+
})));
|
|
98
|
+
case 1:
|
|
99
|
+
_context3.n = 2;
|
|
100
|
+
return step("Undo/redo are disabled initially", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
101
|
+
var buttons;
|
|
102
|
+
return _regenerator().w(function (_context2) {
|
|
103
|
+
while (1) switch (_context2.n) {
|
|
104
|
+
case 0:
|
|
105
|
+
buttons = canvas.getAllByRole("button"); // First two buttons are undo and redo
|
|
106
|
+
expect(buttons[0]).toBeDisabled();
|
|
107
|
+
expect(buttons[1]).toBeDisabled();
|
|
108
|
+
case 1:
|
|
109
|
+
return _context2.a(2);
|
|
110
|
+
}
|
|
111
|
+
}, _callee2);
|
|
112
|
+
})));
|
|
113
|
+
case 2:
|
|
114
|
+
return _context3.a(2);
|
|
115
|
+
}
|
|
116
|
+
}, _callee3);
|
|
117
|
+
}));
|
|
118
|
+
function play(_x) {
|
|
119
|
+
return _play.apply(this, arguments);
|
|
120
|
+
}
|
|
121
|
+
return play;
|
|
122
|
+
}()
|
|
123
|
+
};
|
|
124
|
+
var BoldOnlyBlock = createTipTapRichTextBlock({
|
|
125
|
+
supports: ["bold"]
|
|
126
|
+
});
|
|
127
|
+
function BoldOnlyStory() {
|
|
128
|
+
var _useState3 = useState(BoldOnlyBlock.defaultValues()),
|
|
129
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
130
|
+
state = _useState4[0],
|
|
131
|
+
setState = _useState4[1];
|
|
132
|
+
return /*#__PURE__*/_jsx(StoryWrapper, {
|
|
133
|
+
state: state,
|
|
134
|
+
children: /*#__PURE__*/_jsx(BoldOnlyBlock.AdminComponent, {
|
|
135
|
+
state: state,
|
|
136
|
+
updateState: setState
|
|
137
|
+
})
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
export var BoldOnly = {
|
|
141
|
+
render: function render() {
|
|
142
|
+
return /*#__PURE__*/_jsx(BoldOnlyStory, {});
|
|
143
|
+
},
|
|
144
|
+
play: function () {
|
|
145
|
+
var _play2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(_ref6) {
|
|
146
|
+
var canvas, step;
|
|
147
|
+
return _regenerator().w(function (_context5) {
|
|
148
|
+
while (1) switch (_context5.n) {
|
|
149
|
+
case 0:
|
|
150
|
+
canvas = _ref6.canvas, step = _ref6.step;
|
|
151
|
+
_context5.n = 1;
|
|
152
|
+
return step("Editor is ready with minimal toolbar", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
|
|
153
|
+
var buttons;
|
|
154
|
+
return _regenerator().w(function (_context4) {
|
|
155
|
+
while (1) switch (_context4.n) {
|
|
156
|
+
case 0:
|
|
157
|
+
_context4.n = 1;
|
|
158
|
+
return waitFor(function () {
|
|
159
|
+
expect(canvas.getByRole("textbox")).toBeInTheDocument();
|
|
160
|
+
}, {
|
|
161
|
+
timeout: 5000
|
|
162
|
+
});
|
|
163
|
+
case 1:
|
|
164
|
+
// Only bold button, no heading select
|
|
165
|
+
expect(canvas.queryByRole("combobox")).not.toBeInTheDocument();
|
|
166
|
+
expect(canvas.queryByText("Default")).not.toBeInTheDocument();
|
|
167
|
+
|
|
168
|
+
// Exactly 1 button (bold only — no undo/redo, no lists, no special chars)
|
|
169
|
+
buttons = canvas.getAllByRole("button");
|
|
170
|
+
expect(buttons).toHaveLength(1);
|
|
171
|
+
case 2:
|
|
172
|
+
return _context4.a(2);
|
|
173
|
+
}
|
|
174
|
+
}, _callee4);
|
|
175
|
+
})));
|
|
176
|
+
case 1:
|
|
177
|
+
return _context5.a(2);
|
|
178
|
+
}
|
|
179
|
+
}, _callee5);
|
|
180
|
+
}));
|
|
181
|
+
function play(_x2) {
|
|
182
|
+
return _play2.apply(this, arguments);
|
|
183
|
+
}
|
|
184
|
+
return play;
|
|
185
|
+
}()
|
|
186
|
+
};
|
|
187
|
+
var BlockStylesBlock = createTipTapRichTextBlock({
|
|
188
|
+
blockStyles: [{
|
|
189
|
+
name: "large-heading",
|
|
190
|
+
label: "Large Heading",
|
|
191
|
+
appliesTo: ["heading-1", "heading-2"],
|
|
192
|
+
element: function element(p) {
|
|
193
|
+
return /*#__PURE__*/_jsx(Typography, _objectSpread({
|
|
194
|
+
sx: {
|
|
195
|
+
fontSize: 48,
|
|
196
|
+
lineHeight: 1.2
|
|
197
|
+
},
|
|
198
|
+
variant: "h1"
|
|
199
|
+
}, p));
|
|
200
|
+
}
|
|
201
|
+
}, {
|
|
202
|
+
name: "intro",
|
|
203
|
+
label: "Intro Text",
|
|
204
|
+
appliesTo: ["paragraph"],
|
|
205
|
+
element: function element(props) {
|
|
206
|
+
return /*#__PURE__*/_jsx("p", _objectSpread({
|
|
207
|
+
style: {
|
|
208
|
+
fontSize: 20,
|
|
209
|
+
fontStyle: "italic"
|
|
210
|
+
}
|
|
211
|
+
}, props));
|
|
212
|
+
}
|
|
213
|
+
}, {
|
|
214
|
+
name: "highlight",
|
|
215
|
+
label: "Highlight",
|
|
216
|
+
element: function element(props) {
|
|
217
|
+
return /*#__PURE__*/_jsx("div", _objectSpread({
|
|
218
|
+
style: {
|
|
219
|
+
backgroundColor: "#fff3cd",
|
|
220
|
+
padding: 8
|
|
221
|
+
}
|
|
222
|
+
}, props));
|
|
223
|
+
}
|
|
224
|
+
}]
|
|
225
|
+
});
|
|
226
|
+
function BlockStylesStory() {
|
|
227
|
+
var _useState5 = useState(BlockStylesBlock.defaultValues()),
|
|
228
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
229
|
+
state = _useState6[0],
|
|
230
|
+
setState = _useState6[1];
|
|
231
|
+
return /*#__PURE__*/_jsx(StoryWrapper, {
|
|
232
|
+
state: state,
|
|
233
|
+
children: /*#__PURE__*/_jsx(BlockStylesBlock.AdminComponent, {
|
|
234
|
+
state: state,
|
|
235
|
+
updateState: setState
|
|
236
|
+
})
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
export var BlockStyles = {
|
|
240
|
+
render: function render() {
|
|
241
|
+
return /*#__PURE__*/_jsx(BlockStylesStory, {});
|
|
242
|
+
},
|
|
243
|
+
play: function () {
|
|
244
|
+
var _play3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(_ref8) {
|
|
245
|
+
var canvas, userEvent, step;
|
|
246
|
+
return _regenerator().w(function (_context9) {
|
|
247
|
+
while (1) switch (_context9.n) {
|
|
248
|
+
case 0:
|
|
249
|
+
canvas = _ref8.canvas, userEvent = _ref8.userEvent, step = _ref8.step;
|
|
250
|
+
_context9.n = 1;
|
|
251
|
+
return step("Editor is ready with block style dropdown", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
|
|
252
|
+
var defaults;
|
|
253
|
+
return _regenerator().w(function (_context6) {
|
|
254
|
+
while (1) switch (_context6.n) {
|
|
255
|
+
case 0:
|
|
256
|
+
_context6.n = 1;
|
|
257
|
+
return waitFor(function () {
|
|
258
|
+
var comboboxes = canvas.getAllByRole("combobox");
|
|
259
|
+
expect(comboboxes).toHaveLength(2);
|
|
260
|
+
}, {
|
|
261
|
+
timeout: 5000
|
|
262
|
+
});
|
|
263
|
+
case 1:
|
|
264
|
+
defaults = canvas.getAllByText("Default");
|
|
265
|
+
expect(defaults.length).toBeGreaterThanOrEqual(2);
|
|
266
|
+
case 2:
|
|
267
|
+
return _context6.a(2);
|
|
268
|
+
}
|
|
269
|
+
}, _callee6);
|
|
270
|
+
})));
|
|
271
|
+
case 1:
|
|
272
|
+
_context9.n = 2;
|
|
273
|
+
return step("Select block style 'Intro Text'", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7() {
|
|
274
|
+
var comboboxes;
|
|
275
|
+
return _regenerator().w(function (_context7) {
|
|
276
|
+
while (1) switch (_context7.n) {
|
|
277
|
+
case 0:
|
|
278
|
+
// Click the second combobox (block style select)
|
|
279
|
+
comboboxes = canvas.getAllByRole("combobox");
|
|
280
|
+
_context7.n = 1;
|
|
281
|
+
return userEvent.click(comboboxes[1]);
|
|
282
|
+
case 1:
|
|
283
|
+
_context7.n = 2;
|
|
284
|
+
return waitFor(function () {
|
|
285
|
+
expect(within(document.body).getByRole("option", {
|
|
286
|
+
name: "Intro Text"
|
|
287
|
+
})).toBeInTheDocument();
|
|
288
|
+
}, {
|
|
289
|
+
timeout: 3000
|
|
290
|
+
});
|
|
291
|
+
case 2:
|
|
292
|
+
_context7.n = 3;
|
|
293
|
+
return userEvent.click(within(document.body).getByRole("option", {
|
|
294
|
+
name: "Intro Text"
|
|
295
|
+
}));
|
|
296
|
+
case 3:
|
|
297
|
+
_context7.n = 4;
|
|
298
|
+
return waitFor(function () {
|
|
299
|
+
expect(canvas.getByText("Intro Text")).toBeInTheDocument();
|
|
300
|
+
}, {
|
|
301
|
+
timeout: 3000
|
|
302
|
+
});
|
|
303
|
+
case 4:
|
|
304
|
+
return _context7.a(2);
|
|
305
|
+
}
|
|
306
|
+
}, _callee7);
|
|
307
|
+
})));
|
|
308
|
+
case 2:
|
|
309
|
+
_context9.n = 3;
|
|
310
|
+
return step("Typing into a styled block preserves character order (cursor does not jump to start)", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
|
|
311
|
+
var editor;
|
|
312
|
+
return _regenerator().w(function (_context8) {
|
|
313
|
+
while (1) switch (_context8.n) {
|
|
314
|
+
case 0:
|
|
315
|
+
editor = canvas.getByRole("textbox");
|
|
316
|
+
_context8.n = 1;
|
|
317
|
+
return userEvent.click(editor);
|
|
318
|
+
case 1:
|
|
319
|
+
_context8.n = 2;
|
|
320
|
+
return userEvent.keyboard("hello");
|
|
321
|
+
case 2:
|
|
322
|
+
_context8.n = 3;
|
|
323
|
+
return waitFor(function () {
|
|
324
|
+
expect(editor).toHaveTextContent("hello");
|
|
325
|
+
}, {
|
|
326
|
+
timeout: 3000
|
|
327
|
+
});
|
|
328
|
+
case 3:
|
|
329
|
+
return _context8.a(2);
|
|
330
|
+
}
|
|
331
|
+
}, _callee8);
|
|
332
|
+
})));
|
|
333
|
+
case 3:
|
|
334
|
+
return _context9.a(2);
|
|
335
|
+
}
|
|
336
|
+
}, _callee9);
|
|
337
|
+
}));
|
|
338
|
+
function play(_x3) {
|
|
339
|
+
return _play3.apply(this, arguments);
|
|
340
|
+
}
|
|
341
|
+
return play;
|
|
342
|
+
}()
|
|
343
|
+
};
|
|
344
|
+
var PlaceholdersBlock = createTipTapRichTextBlock({
|
|
345
|
+
placeholders: [{
|
|
346
|
+
name: "firstName",
|
|
347
|
+
label: "First Name"
|
|
348
|
+
}, {
|
|
349
|
+
name: "lastName",
|
|
350
|
+
label: "Last Name"
|
|
351
|
+
}, {
|
|
352
|
+
name: "email",
|
|
353
|
+
label: "Email Address"
|
|
354
|
+
}, {
|
|
355
|
+
name: "company",
|
|
356
|
+
label: "Company"
|
|
357
|
+
}]
|
|
358
|
+
});
|
|
359
|
+
function PlaceholdersStory() {
|
|
360
|
+
var _useState7 = useState(PlaceholdersBlock.defaultValues()),
|
|
361
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
362
|
+
state = _useState8[0],
|
|
363
|
+
setState = _useState8[1];
|
|
364
|
+
return /*#__PURE__*/_jsx(StoryWrapper, {
|
|
365
|
+
state: state,
|
|
366
|
+
children: /*#__PURE__*/_jsx(PlaceholdersBlock.AdminComponent, {
|
|
367
|
+
state: state,
|
|
368
|
+
updateState: setState
|
|
369
|
+
})
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
export var Placeholders = {
|
|
373
|
+
render: function render() {
|
|
374
|
+
return /*#__PURE__*/_jsx(PlaceholdersStory, {});
|
|
375
|
+
},
|
|
376
|
+
play: function () {
|
|
377
|
+
var _play4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12(_ref10) {
|
|
378
|
+
var canvas, userEvent, step;
|
|
379
|
+
return _regenerator().w(function (_context12) {
|
|
380
|
+
while (1) switch (_context12.n) {
|
|
381
|
+
case 0:
|
|
382
|
+
canvas = _ref10.canvas, userEvent = _ref10.userEvent, step = _ref10.step;
|
|
383
|
+
_context12.n = 1;
|
|
384
|
+
return step("Editor is ready with placeholder button", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0() {
|
|
385
|
+
return _regenerator().w(function (_context0) {
|
|
386
|
+
while (1) switch (_context0.n) {
|
|
387
|
+
case 0:
|
|
388
|
+
_context0.n = 1;
|
|
389
|
+
return waitFor(function () {
|
|
390
|
+
expect(canvas.getByRole("textbox")).toBeInTheDocument();
|
|
391
|
+
}, {
|
|
392
|
+
timeout: 5000
|
|
393
|
+
});
|
|
394
|
+
case 1:
|
|
395
|
+
// The placeholder button is identified by its accessible name, not by index among all toolbar buttons
|
|
396
|
+
expect(canvas.getByRole("button", {
|
|
397
|
+
name: "Insert placeholder"
|
|
398
|
+
})).toBeInTheDocument();
|
|
399
|
+
case 2:
|
|
400
|
+
return _context0.a(2);
|
|
401
|
+
}
|
|
402
|
+
}, _callee0);
|
|
403
|
+
})));
|
|
404
|
+
case 1:
|
|
405
|
+
_context12.n = 2;
|
|
406
|
+
return step("Open the placeholder menu and insert 'First Name'", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
|
|
407
|
+
return _regenerator().w(function (_context1) {
|
|
408
|
+
while (1) switch (_context1.n) {
|
|
409
|
+
case 0:
|
|
410
|
+
_context1.n = 1;
|
|
411
|
+
return userEvent.click(canvas.getByRole("button", {
|
|
412
|
+
name: "Insert placeholder"
|
|
413
|
+
}));
|
|
414
|
+
case 1:
|
|
415
|
+
_context1.n = 2;
|
|
416
|
+
return waitFor(function () {
|
|
417
|
+
expect(within(document.body).getByRole("menuitem", {
|
|
418
|
+
name: "First Name"
|
|
419
|
+
})).toBeInTheDocument();
|
|
420
|
+
}, {
|
|
421
|
+
timeout: 3000
|
|
422
|
+
});
|
|
423
|
+
case 2:
|
|
424
|
+
_context1.n = 3;
|
|
425
|
+
return userEvent.click(within(document.body).getByRole("menuitem", {
|
|
426
|
+
name: "First Name"
|
|
427
|
+
}));
|
|
428
|
+
case 3:
|
|
429
|
+
return _context1.a(2);
|
|
430
|
+
}
|
|
431
|
+
}, _callee1);
|
|
432
|
+
})));
|
|
433
|
+
case 2:
|
|
434
|
+
_context12.n = 3;
|
|
435
|
+
return step("Inserted placeholder is rendered as a chip in the editor", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10() {
|
|
436
|
+
var editor;
|
|
437
|
+
return _regenerator().w(function (_context10) {
|
|
438
|
+
while (1) switch (_context10.n) {
|
|
439
|
+
case 0:
|
|
440
|
+
editor = canvas.getByRole("textbox"); // Placeholders render as chips labelled `{{name}}`
|
|
441
|
+
_context10.n = 1;
|
|
442
|
+
return waitFor(function () {
|
|
443
|
+
expect(within(editor).getByText("{{firstName}}")).toBeInTheDocument();
|
|
444
|
+
}, {
|
|
445
|
+
timeout: 3000
|
|
446
|
+
});
|
|
447
|
+
case 1:
|
|
448
|
+
return _context10.a(2);
|
|
449
|
+
}
|
|
450
|
+
}, _callee10);
|
|
451
|
+
})));
|
|
452
|
+
case 3:
|
|
453
|
+
_context12.n = 4;
|
|
454
|
+
return step("Block state contains the placeholder node", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11() {
|
|
455
|
+
return _regenerator().w(function (_context11) {
|
|
456
|
+
while (1) switch (_context11.n) {
|
|
457
|
+
case 0:
|
|
458
|
+
_context11.n = 1;
|
|
459
|
+
return waitFor(function () {
|
|
460
|
+
var _canvas$getByText$tex;
|
|
461
|
+
var state = JSON.parse((_canvas$getByText$tex = canvas.getByText(/"tipTapContent"/).textContent) !== null && _canvas$getByText$tex !== void 0 ? _canvas$getByText$tex : "{}");
|
|
462
|
+
var _state$tipTapContent$ = _slicedToArray(state.tipTapContent.content, 1),
|
|
463
|
+
paragraph = _state$tipTapContent$[0];
|
|
464
|
+
expect(paragraph.content).toContainEqual({
|
|
465
|
+
type: "placeholder",
|
|
466
|
+
attrs: {
|
|
467
|
+
name: "firstName"
|
|
468
|
+
}
|
|
469
|
+
});
|
|
470
|
+
}, {
|
|
471
|
+
timeout: 3000
|
|
472
|
+
});
|
|
473
|
+
case 1:
|
|
474
|
+
return _context11.a(2);
|
|
475
|
+
}
|
|
476
|
+
}, _callee11);
|
|
477
|
+
})));
|
|
478
|
+
case 4:
|
|
479
|
+
return _context12.a(2);
|
|
480
|
+
}
|
|
481
|
+
}, _callee12);
|
|
482
|
+
}));
|
|
483
|
+
function play(_x4) {
|
|
484
|
+
return _play4.apply(this, arguments);
|
|
485
|
+
}
|
|
486
|
+
return play;
|
|
487
|
+
}()
|
|
488
|
+
};
|
|
489
|
+
var PlaceholdersWithContentBlock = createTipTapRichTextBlock({
|
|
490
|
+
supports: ["bold", "italic"],
|
|
491
|
+
placeholders: [{
|
|
492
|
+
name: "firstName",
|
|
493
|
+
label: "First Name"
|
|
494
|
+
}, {
|
|
495
|
+
name: "lastName",
|
|
496
|
+
label: "Last Name"
|
|
497
|
+
}, {
|
|
498
|
+
name: "email",
|
|
499
|
+
label: "Email Address"
|
|
500
|
+
}]
|
|
501
|
+
});
|
|
502
|
+
function PlaceholdersWithContentStory() {
|
|
503
|
+
var _useState9 = useState({
|
|
504
|
+
tipTapContent: {
|
|
505
|
+
type: "doc",
|
|
506
|
+
content: [{
|
|
507
|
+
type: "paragraph",
|
|
508
|
+
content: [{
|
|
509
|
+
type: "text",
|
|
510
|
+
text: "Hello "
|
|
511
|
+
}, {
|
|
512
|
+
type: "placeholder",
|
|
513
|
+
attrs: {
|
|
514
|
+
name: "firstName"
|
|
515
|
+
}
|
|
516
|
+
}, {
|
|
517
|
+
type: "text",
|
|
518
|
+
text: " "
|
|
519
|
+
}, {
|
|
520
|
+
type: "placeholder",
|
|
521
|
+
attrs: {
|
|
522
|
+
name: "lastName"
|
|
523
|
+
}
|
|
524
|
+
}, {
|
|
525
|
+
type: "text",
|
|
526
|
+
text: ", welcome to our platform!"
|
|
527
|
+
}]
|
|
528
|
+
}, {
|
|
529
|
+
type: "paragraph",
|
|
530
|
+
content: [{
|
|
531
|
+
type: "text",
|
|
532
|
+
text: "Your registered email is: "
|
|
533
|
+
}, {
|
|
534
|
+
type: "placeholder",
|
|
535
|
+
attrs: {
|
|
536
|
+
name: "email"
|
|
537
|
+
}
|
|
538
|
+
}]
|
|
539
|
+
}]
|
|
540
|
+
}
|
|
541
|
+
}),
|
|
542
|
+
_useState0 = _slicedToArray(_useState9, 2),
|
|
543
|
+
state = _useState0[0],
|
|
544
|
+
setState = _useState0[1];
|
|
545
|
+
return /*#__PURE__*/_jsx(StoryWrapper, {
|
|
546
|
+
state: state,
|
|
547
|
+
children: /*#__PURE__*/_jsx(PlaceholdersWithContentBlock.AdminComponent, {
|
|
548
|
+
state: state,
|
|
549
|
+
updateState: setState
|
|
550
|
+
})
|
|
551
|
+
});
|
|
552
|
+
}
|
|
553
|
+
export var PlaceholdersWithContent = {
|
|
554
|
+
render: function render() {
|
|
555
|
+
return /*#__PURE__*/_jsx(PlaceholdersWithContentStory, {});
|
|
556
|
+
},
|
|
557
|
+
play: function () {
|
|
558
|
+
var _play5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(_ref15) {
|
|
559
|
+
var canvas, step;
|
|
560
|
+
return _regenerator().w(function (_context15) {
|
|
561
|
+
while (1) switch (_context15.n) {
|
|
562
|
+
case 0:
|
|
563
|
+
canvas = _ref15.canvas, step = _ref15.step;
|
|
564
|
+
_context15.n = 1;
|
|
565
|
+
return step("Editor is ready", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13() {
|
|
566
|
+
return _regenerator().w(function (_context13) {
|
|
567
|
+
while (1) switch (_context13.n) {
|
|
568
|
+
case 0:
|
|
569
|
+
_context13.n = 1;
|
|
570
|
+
return waitFor(function () {
|
|
571
|
+
expect(canvas.getByRole("textbox")).toBeInTheDocument();
|
|
572
|
+
}, {
|
|
573
|
+
timeout: 5000
|
|
574
|
+
});
|
|
575
|
+
case 1:
|
|
576
|
+
return _context13.a(2);
|
|
577
|
+
}
|
|
578
|
+
}, _callee13);
|
|
579
|
+
})));
|
|
580
|
+
case 1:
|
|
581
|
+
_context15.n = 2;
|
|
582
|
+
return step("Pre-filled placeholders are rendered as chips", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14() {
|
|
583
|
+
var editor;
|
|
584
|
+
return _regenerator().w(function (_context14) {
|
|
585
|
+
while (1) switch (_context14.n) {
|
|
586
|
+
case 0:
|
|
587
|
+
editor = canvas.getByRole("textbox");
|
|
588
|
+
_context14.n = 1;
|
|
589
|
+
return waitFor(function () {
|
|
590
|
+
// Each placeholder is rendered as a chip labelled `{{name}}` (not as plain text)
|
|
591
|
+
for (var _i = 0, _arr = ["firstName", "lastName", "email"]; _i < _arr.length; _i++) {
|
|
592
|
+
var name = _arr[_i];
|
|
593
|
+
var chipLabel = within(editor).getByText("{{".concat(name, "}}"));
|
|
594
|
+
expect(chipLabel.closest(".".concat(chipClasses.root))).toBeInTheDocument();
|
|
595
|
+
}
|
|
596
|
+
}, {
|
|
597
|
+
timeout: 3000
|
|
598
|
+
});
|
|
599
|
+
case 1:
|
|
600
|
+
// Text surrounding the chips is preserved
|
|
601
|
+
expect(editor).toHaveTextContent("Hello {{firstName}} {{lastName}}, welcome to our platform!");
|
|
602
|
+
expect(editor).toHaveTextContent("Your registered email is: {{email}}");
|
|
603
|
+
case 2:
|
|
604
|
+
return _context14.a(2);
|
|
605
|
+
}
|
|
606
|
+
}, _callee14);
|
|
607
|
+
})));
|
|
608
|
+
case 2:
|
|
609
|
+
return _context15.a(2);
|
|
610
|
+
}
|
|
611
|
+
}, _callee15);
|
|
612
|
+
}));
|
|
613
|
+
function play(_x5) {
|
|
614
|
+
return _play5.apply(this, arguments);
|
|
615
|
+
}
|
|
616
|
+
return play;
|
|
617
|
+
}()
|
|
618
|
+
};
|
|
619
|
+
var BlockStyleInteractionsBlock = createTipTapRichTextBlock({
|
|
620
|
+
blockStyles: [{
|
|
621
|
+
name: "chapter-heading",
|
|
622
|
+
label: "Chapter Heading",
|
|
623
|
+
appliesTo: ["heading-1"],
|
|
624
|
+
element: function element(props) {
|
|
625
|
+
return /*#__PURE__*/_jsx("h1", _objectSpread({
|
|
626
|
+
style: {
|
|
627
|
+
textTransform: "uppercase",
|
|
628
|
+
letterSpacing: "0.1em"
|
|
629
|
+
}
|
|
630
|
+
}, props));
|
|
631
|
+
}
|
|
632
|
+
}, {
|
|
633
|
+
name: "large-heading",
|
|
634
|
+
label: "Large Heading",
|
|
635
|
+
appliesTo: ["heading-1", "heading-2"],
|
|
636
|
+
element: function element(p) {
|
|
637
|
+
return /*#__PURE__*/_jsx(Typography, _objectSpread({
|
|
638
|
+
sx: {
|
|
639
|
+
fontSize: 48,
|
|
640
|
+
lineHeight: 1.2
|
|
641
|
+
},
|
|
642
|
+
variant: "h1"
|
|
643
|
+
}, p));
|
|
644
|
+
}
|
|
645
|
+
}, {
|
|
646
|
+
name: "intro",
|
|
647
|
+
label: "Intro Text",
|
|
648
|
+
appliesTo: ["paragraph"],
|
|
649
|
+
element: function element(props) {
|
|
650
|
+
return /*#__PURE__*/_jsx("p", _objectSpread({
|
|
651
|
+
style: {
|
|
652
|
+
fontSize: 20,
|
|
653
|
+
fontStyle: "italic"
|
|
654
|
+
}
|
|
655
|
+
}, props));
|
|
656
|
+
}
|
|
657
|
+
}, {
|
|
658
|
+
name: "highlight",
|
|
659
|
+
label: "Highlight",
|
|
660
|
+
element: function element(props) {
|
|
661
|
+
return /*#__PURE__*/_jsx("div", _objectSpread({
|
|
662
|
+
style: {
|
|
663
|
+
backgroundColor: "#fff3cd",
|
|
664
|
+
padding: 8
|
|
665
|
+
}
|
|
666
|
+
}, props));
|
|
667
|
+
}
|
|
668
|
+
}]
|
|
669
|
+
});
|
|
670
|
+
function BlockStyleInteractionsStory() {
|
|
671
|
+
var _useState1 = useState(BlockStyleInteractionsBlock.defaultValues()),
|
|
672
|
+
_useState10 = _slicedToArray(_useState1, 2),
|
|
673
|
+
state = _useState10[0],
|
|
674
|
+
setState = _useState10[1];
|
|
675
|
+
return /*#__PURE__*/_jsx(StoryWrapper, {
|
|
676
|
+
state: state,
|
|
677
|
+
children: /*#__PURE__*/_jsx(BlockStyleInteractionsBlock.AdminComponent, {
|
|
678
|
+
state: state,
|
|
679
|
+
updateState: setState
|
|
680
|
+
})
|
|
681
|
+
});
|
|
682
|
+
}
|
|
683
|
+
export var BlockStyleInteractions = {
|
|
684
|
+
render: function render() {
|
|
685
|
+
return /*#__PURE__*/_jsx(BlockStyleInteractionsStory, {});
|
|
686
|
+
},
|
|
687
|
+
play: function () {
|
|
688
|
+
var _play6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee24(_ref18) {
|
|
689
|
+
var canvas, userEvent, step;
|
|
690
|
+
return _regenerator().w(function (_context24) {
|
|
691
|
+
while (1) switch (_context24.n) {
|
|
692
|
+
case 0:
|
|
693
|
+
canvas = _ref18.canvas, userEvent = _ref18.userEvent, step = _ref18.step;
|
|
694
|
+
_context24.n = 1;
|
|
695
|
+
return step("Editor is ready", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16() {
|
|
696
|
+
return _regenerator().w(function (_context16) {
|
|
697
|
+
while (1) switch (_context16.n) {
|
|
698
|
+
case 0:
|
|
699
|
+
_context16.n = 1;
|
|
700
|
+
return waitFor(function () {
|
|
701
|
+
expect(canvas.getByRole("textbox")).toBeInTheDocument();
|
|
702
|
+
}, {
|
|
703
|
+
timeout: 5000
|
|
704
|
+
});
|
|
705
|
+
case 1:
|
|
706
|
+
return _context16.a(2);
|
|
707
|
+
}
|
|
708
|
+
}, _callee16);
|
|
709
|
+
})));
|
|
710
|
+
case 1:
|
|
711
|
+
_context24.n = 2;
|
|
712
|
+
return step("Select Heading 1", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17() {
|
|
713
|
+
var blockTypeSelect;
|
|
714
|
+
return _regenerator().w(function (_context17) {
|
|
715
|
+
while (1) switch (_context17.n) {
|
|
716
|
+
case 0:
|
|
717
|
+
blockTypeSelect = canvas.getAllByRole("combobox")[0];
|
|
718
|
+
_context17.n = 1;
|
|
719
|
+
return userEvent.click(blockTypeSelect);
|
|
720
|
+
case 1:
|
|
721
|
+
_context17.n = 2;
|
|
722
|
+
return waitFor(function () {
|
|
723
|
+
expect(within(document.body).getByText("Heading 1")).toBeInTheDocument();
|
|
724
|
+
}, {
|
|
725
|
+
timeout: 3000
|
|
726
|
+
});
|
|
727
|
+
case 2:
|
|
728
|
+
_context17.n = 3;
|
|
729
|
+
return userEvent.click(within(document.body).getByText("Heading 1"));
|
|
730
|
+
case 3:
|
|
731
|
+
_context17.n = 4;
|
|
732
|
+
return waitFor(function () {
|
|
733
|
+
expect(canvas.getAllByRole("combobox")[0]).toHaveTextContent("Heading 1");
|
|
734
|
+
}, {
|
|
735
|
+
timeout: 3000
|
|
736
|
+
});
|
|
737
|
+
case 4:
|
|
738
|
+
return _context17.a(2);
|
|
739
|
+
}
|
|
740
|
+
}, _callee17);
|
|
741
|
+
})));
|
|
742
|
+
case 2:
|
|
743
|
+
_context24.n = 3;
|
|
744
|
+
return step("Verify available styles for Heading 1: Chapter Heading, Large Heading, Highlight — but not Intro Text", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18() {
|
|
745
|
+
var blockStyleSelect;
|
|
746
|
+
return _regenerator().w(function (_context18) {
|
|
747
|
+
while (1) switch (_context18.n) {
|
|
748
|
+
case 0:
|
|
749
|
+
blockStyleSelect = canvas.getAllByRole("combobox")[1];
|
|
750
|
+
_context18.n = 1;
|
|
751
|
+
return userEvent.click(blockStyleSelect);
|
|
752
|
+
case 1:
|
|
753
|
+
_context18.n = 2;
|
|
754
|
+
return waitFor(function () {
|
|
755
|
+
var body = within(document.body);
|
|
756
|
+
expect(body.getByText("Chapter Heading")).toBeInTheDocument();
|
|
757
|
+
expect(body.getByText("Large Heading")).toBeInTheDocument();
|
|
758
|
+
expect(body.getByText("Highlight")).toBeInTheDocument();
|
|
759
|
+
expect(body.queryByText("Intro Text")).not.toBeInTheDocument();
|
|
760
|
+
}, {
|
|
761
|
+
timeout: 3000
|
|
762
|
+
});
|
|
763
|
+
case 2:
|
|
764
|
+
return _context18.a(2);
|
|
765
|
+
}
|
|
766
|
+
}, _callee18);
|
|
767
|
+
})));
|
|
768
|
+
case 3:
|
|
769
|
+
_context24.n = 4;
|
|
770
|
+
return step("Select 'Chapter Heading' style (heading-1 only)", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19() {
|
|
771
|
+
return _regenerator().w(function (_context19) {
|
|
772
|
+
while (1) switch (_context19.n) {
|
|
773
|
+
case 0:
|
|
774
|
+
_context19.n = 1;
|
|
775
|
+
return userEvent.click(within(document.body).getByText("Chapter Heading"));
|
|
776
|
+
case 1:
|
|
777
|
+
_context19.n = 2;
|
|
778
|
+
return waitFor(function () {
|
|
779
|
+
expect(canvas.getAllByRole("combobox")[1]).toHaveTextContent("Chapter Heading");
|
|
780
|
+
}, {
|
|
781
|
+
timeout: 3000
|
|
782
|
+
});
|
|
783
|
+
case 2:
|
|
784
|
+
return _context19.a(2);
|
|
785
|
+
}
|
|
786
|
+
}, _callee19);
|
|
787
|
+
})));
|
|
788
|
+
case 4:
|
|
789
|
+
_context24.n = 5;
|
|
790
|
+
return step("Verify chapter heading styling is applied (uppercase)", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20() {
|
|
791
|
+
return _regenerator().w(function (_context20) {
|
|
792
|
+
while (1) switch (_context20.n) {
|
|
793
|
+
case 0:
|
|
794
|
+
_context20.n = 1;
|
|
795
|
+
return waitFor(function () {
|
|
796
|
+
var styledEl = document.querySelector('[data-block-style="chapter-heading"]');
|
|
797
|
+
expect(styledEl).toBeTruthy();
|
|
798
|
+
expect(styledEl).toHaveStyle({
|
|
799
|
+
textTransform: "uppercase"
|
|
800
|
+
});
|
|
801
|
+
}, {
|
|
802
|
+
timeout: 3000
|
|
803
|
+
});
|
|
804
|
+
case 1:
|
|
805
|
+
return _context20.a(2);
|
|
806
|
+
}
|
|
807
|
+
}, _callee20);
|
|
808
|
+
})));
|
|
809
|
+
case 5:
|
|
810
|
+
_context24.n = 6;
|
|
811
|
+
return step("Switch to Heading 2", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21() {
|
|
812
|
+
var blockTypeSelect;
|
|
813
|
+
return _regenerator().w(function (_context21) {
|
|
814
|
+
while (1) switch (_context21.n) {
|
|
815
|
+
case 0:
|
|
816
|
+
blockTypeSelect = canvas.getAllByRole("combobox")[0];
|
|
817
|
+
_context21.n = 1;
|
|
818
|
+
return userEvent.click(blockTypeSelect);
|
|
819
|
+
case 1:
|
|
820
|
+
_context21.n = 2;
|
|
821
|
+
return waitFor(function () {
|
|
822
|
+
expect(within(document.body).getByText("Heading 2")).toBeInTheDocument();
|
|
823
|
+
}, {
|
|
824
|
+
timeout: 3000
|
|
825
|
+
});
|
|
826
|
+
case 2:
|
|
827
|
+
_context21.n = 3;
|
|
828
|
+
return userEvent.click(within(document.body).getByText("Heading 2"));
|
|
829
|
+
case 3:
|
|
830
|
+
_context21.n = 4;
|
|
831
|
+
return waitFor(function () {
|
|
832
|
+
expect(canvas.getAllByRole("combobox")[0]).toHaveTextContent("Heading 2");
|
|
833
|
+
}, {
|
|
834
|
+
timeout: 3000
|
|
835
|
+
});
|
|
836
|
+
case 4:
|
|
837
|
+
return _context21.a(2);
|
|
838
|
+
}
|
|
839
|
+
}, _callee21);
|
|
840
|
+
})));
|
|
841
|
+
case 6:
|
|
842
|
+
_context24.n = 7;
|
|
843
|
+
return step("Block style auto-resets to Default (Chapter Heading doesn't apply to heading-2)", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee22() {
|
|
844
|
+
return _regenerator().w(function (_context22) {
|
|
845
|
+
while (1) switch (_context22.n) {
|
|
846
|
+
case 0:
|
|
847
|
+
_context22.n = 1;
|
|
848
|
+
return waitFor(function () {
|
|
849
|
+
expect(canvas.getAllByRole("combobox")[1]).toHaveTextContent("Default");
|
|
850
|
+
}, {
|
|
851
|
+
timeout: 3000
|
|
852
|
+
});
|
|
853
|
+
case 1:
|
|
854
|
+
return _context22.a(2);
|
|
855
|
+
}
|
|
856
|
+
}, _callee22);
|
|
857
|
+
})));
|
|
858
|
+
case 7:
|
|
859
|
+
_context24.n = 8;
|
|
860
|
+
return step("Verify chapter heading styling is removed", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee23() {
|
|
861
|
+
return _regenerator().w(function (_context23) {
|
|
862
|
+
while (1) switch (_context23.n) {
|
|
863
|
+
case 0:
|
|
864
|
+
_context23.n = 1;
|
|
865
|
+
return waitFor(function () {
|
|
866
|
+
expect(document.querySelector("[data-block-style]")).toBeNull();
|
|
867
|
+
}, {
|
|
868
|
+
timeout: 3000
|
|
869
|
+
});
|
|
870
|
+
case 1:
|
|
871
|
+
return _context23.a(2);
|
|
872
|
+
}
|
|
873
|
+
}, _callee23);
|
|
874
|
+
})));
|
|
875
|
+
case 8:
|
|
876
|
+
return _context24.a(2);
|
|
877
|
+
}
|
|
878
|
+
}, _callee24);
|
|
879
|
+
}));
|
|
880
|
+
function play(_x6) {
|
|
881
|
+
return _play6.apply(this, arguments);
|
|
882
|
+
}
|
|
883
|
+
return play;
|
|
884
|
+
}()
|
|
885
|
+
};
|
|
886
|
+
var ListBlockStylesBlock = createTipTapRichTextBlock({
|
|
887
|
+
supports: ["bold", "ordered-list", "unordered-list", "heading"],
|
|
888
|
+
blockStyles: [{
|
|
889
|
+
name: "intro",
|
|
890
|
+
label: "Intro Text",
|
|
891
|
+
appliesTo: ["paragraph"],
|
|
892
|
+
element: function element(props) {
|
|
893
|
+
return /*#__PURE__*/_jsx("p", _objectSpread({
|
|
894
|
+
style: {
|
|
895
|
+
fontSize: 20,
|
|
896
|
+
fontStyle: "italic"
|
|
897
|
+
}
|
|
898
|
+
}, props));
|
|
899
|
+
}
|
|
900
|
+
}, {
|
|
901
|
+
name: "list-large",
|
|
902
|
+
label: "List Large",
|
|
903
|
+
appliesTo: ["ordered-list", "unordered-list"],
|
|
904
|
+
element: function element(props) {
|
|
905
|
+
return /*#__PURE__*/_jsx("p", _objectSpread({
|
|
906
|
+
style: {
|
|
907
|
+
fontSize: 18,
|
|
908
|
+
lineHeight: "26px"
|
|
909
|
+
}
|
|
910
|
+
}, props));
|
|
911
|
+
}
|
|
912
|
+
}, {
|
|
913
|
+
name: "list-small",
|
|
914
|
+
label: "List Small",
|
|
915
|
+
appliesTo: ["ordered-list", "unordered-list"],
|
|
916
|
+
element: function element(props) {
|
|
917
|
+
return /*#__PURE__*/_jsx("p", _objectSpread({
|
|
918
|
+
style: {
|
|
919
|
+
fontSize: 14,
|
|
920
|
+
lineHeight: "20px"
|
|
921
|
+
}
|
|
922
|
+
}, props));
|
|
923
|
+
}
|
|
924
|
+
}, {
|
|
925
|
+
name: "ol-only",
|
|
926
|
+
label: "Numbered Style",
|
|
927
|
+
appliesTo: ["ordered-list"],
|
|
928
|
+
element: function element(props) {
|
|
929
|
+
return /*#__PURE__*/_jsx("p", _objectSpread({
|
|
930
|
+
style: {
|
|
931
|
+
fontSize: 16,
|
|
932
|
+
fontWeight: 600
|
|
933
|
+
}
|
|
934
|
+
}, props));
|
|
935
|
+
}
|
|
936
|
+
}, {
|
|
937
|
+
name: "universal",
|
|
938
|
+
label: "Universal",
|
|
939
|
+
element: function element(props) {
|
|
940
|
+
return /*#__PURE__*/_jsx("div", _objectSpread({
|
|
941
|
+
style: {
|
|
942
|
+
backgroundColor: "#e8f5e9",
|
|
943
|
+
padding: 4
|
|
944
|
+
}
|
|
945
|
+
}, props));
|
|
946
|
+
}
|
|
947
|
+
}]
|
|
948
|
+
});
|
|
949
|
+
function ListBlockStylesStory() {
|
|
950
|
+
var _useState11 = useState(ListBlockStylesBlock.defaultValues()),
|
|
951
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
952
|
+
state = _useState12[0],
|
|
953
|
+
setState = _useState12[1];
|
|
954
|
+
return /*#__PURE__*/_jsx(StoryWrapper, {
|
|
955
|
+
state: state,
|
|
956
|
+
children: /*#__PURE__*/_jsx(ListBlockStylesBlock.AdminComponent, {
|
|
957
|
+
state: state,
|
|
958
|
+
updateState: setState
|
|
959
|
+
})
|
|
960
|
+
});
|
|
961
|
+
}
|
|
962
|
+
export var ListBlockStyles = {
|
|
963
|
+
render: function render() {
|
|
964
|
+
return /*#__PURE__*/_jsx(ListBlockStylesStory, {});
|
|
965
|
+
},
|
|
966
|
+
play: function () {
|
|
967
|
+
var _play7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee34(_ref27) {
|
|
968
|
+
var canvas, userEvent, step;
|
|
969
|
+
return _regenerator().w(function (_context34) {
|
|
970
|
+
while (1) switch (_context34.n) {
|
|
971
|
+
case 0:
|
|
972
|
+
canvas = _ref27.canvas, userEvent = _ref27.userEvent, step = _ref27.step;
|
|
973
|
+
_context34.n = 1;
|
|
974
|
+
return step("Editor is ready with two comboboxes", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee25() {
|
|
975
|
+
return _regenerator().w(function (_context25) {
|
|
976
|
+
while (1) switch (_context25.n) {
|
|
977
|
+
case 0:
|
|
978
|
+
_context25.n = 1;
|
|
979
|
+
return waitFor(function () {
|
|
980
|
+
expect(canvas.getByRole("textbox")).toBeInTheDocument();
|
|
981
|
+
expect(canvas.getAllByRole("combobox")).toHaveLength(2);
|
|
982
|
+
}, {
|
|
983
|
+
timeout: 5000
|
|
984
|
+
});
|
|
985
|
+
case 1:
|
|
986
|
+
return _context25.a(2);
|
|
987
|
+
}
|
|
988
|
+
}, _callee25);
|
|
989
|
+
})));
|
|
990
|
+
case 1:
|
|
991
|
+
_context34.n = 2;
|
|
992
|
+
return step("Paragraph mode: block style dropdown shows paragraph-applicable styles only", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee26() {
|
|
993
|
+
var blockStyleSelect;
|
|
994
|
+
return _regenerator().w(function (_context26) {
|
|
995
|
+
while (1) switch (_context26.n) {
|
|
996
|
+
case 0:
|
|
997
|
+
blockStyleSelect = canvas.getAllByRole("combobox")[1];
|
|
998
|
+
_context26.n = 1;
|
|
999
|
+
return userEvent.click(blockStyleSelect);
|
|
1000
|
+
case 1:
|
|
1001
|
+
_context26.n = 2;
|
|
1002
|
+
return waitFor(function () {
|
|
1003
|
+
var body = within(document.body);
|
|
1004
|
+
expect(body.getByText("Intro Text")).toBeInTheDocument();
|
|
1005
|
+
expect(body.getByText("Universal")).toBeInTheDocument();
|
|
1006
|
+
expect(body.queryByText("List Large")).not.toBeInTheDocument();
|
|
1007
|
+
expect(body.queryByText("List Small")).not.toBeInTheDocument();
|
|
1008
|
+
expect(body.queryByText("Numbered Style")).not.toBeInTheDocument();
|
|
1009
|
+
}, {
|
|
1010
|
+
timeout: 3000
|
|
1011
|
+
});
|
|
1012
|
+
case 2:
|
|
1013
|
+
_context26.n = 3;
|
|
1014
|
+
return userEvent.keyboard("{Escape}");
|
|
1015
|
+
case 3:
|
|
1016
|
+
return _context26.a(2);
|
|
1017
|
+
}
|
|
1018
|
+
}, _callee26);
|
|
1019
|
+
})));
|
|
1020
|
+
case 2:
|
|
1021
|
+
_context34.n = 3;
|
|
1022
|
+
return step("Click the editor, then type text so list toggle works", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee27() {
|
|
1023
|
+
var editor;
|
|
1024
|
+
return _regenerator().w(function (_context27) {
|
|
1025
|
+
while (1) switch (_context27.n) {
|
|
1026
|
+
case 0:
|
|
1027
|
+
editor = canvas.getByRole("textbox");
|
|
1028
|
+
_context27.n = 1;
|
|
1029
|
+
return userEvent.click(editor);
|
|
1030
|
+
case 1:
|
|
1031
|
+
_context27.n = 2;
|
|
1032
|
+
return userEvent.keyboard("List item text");
|
|
1033
|
+
case 2:
|
|
1034
|
+
return _context27.a(2);
|
|
1035
|
+
}
|
|
1036
|
+
}, _callee27);
|
|
1037
|
+
})));
|
|
1038
|
+
case 3:
|
|
1039
|
+
_context34.n = 4;
|
|
1040
|
+
return step("Toggle bullet list via keyboard shortcut", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee28() {
|
|
1041
|
+
var editor, mod;
|
|
1042
|
+
return _regenerator().w(function (_context28) {
|
|
1043
|
+
while (1) switch (_context28.n) {
|
|
1044
|
+
case 0:
|
|
1045
|
+
editor = canvas.getByRole("textbox");
|
|
1046
|
+
_context28.n = 1;
|
|
1047
|
+
return userEvent.click(editor);
|
|
1048
|
+
case 1:
|
|
1049
|
+
// TipTap binds list shortcuts to Mod-Shift-{7,8}: Meta on Mac, Control elsewhere
|
|
1050
|
+
mod = /Mac/i.test(navigator.platform) ? "Meta" : "Control";
|
|
1051
|
+
_context28.n = 2;
|
|
1052
|
+
return userEvent.keyboard("{".concat(mod, ">}{Shift>}8{/Shift}{/").concat(mod, "}"));
|
|
1053
|
+
case 2:
|
|
1054
|
+
_context28.n = 3;
|
|
1055
|
+
return waitFor(function () {
|
|
1056
|
+
expect(editor.querySelector("ul")).toBeTruthy();
|
|
1057
|
+
}, {
|
|
1058
|
+
timeout: 3000
|
|
1059
|
+
});
|
|
1060
|
+
case 3:
|
|
1061
|
+
return _context28.a(2);
|
|
1062
|
+
}
|
|
1063
|
+
}, _callee28);
|
|
1064
|
+
})));
|
|
1065
|
+
case 4:
|
|
1066
|
+
_context34.n = 5;
|
|
1067
|
+
return step("Unordered list mode: block style dropdown shows UL-applicable styles", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee29() {
|
|
1068
|
+
var blockStyleSelect;
|
|
1069
|
+
return _regenerator().w(function (_context29) {
|
|
1070
|
+
while (1) switch (_context29.n) {
|
|
1071
|
+
case 0:
|
|
1072
|
+
_context29.n = 1;
|
|
1073
|
+
return waitFor(function () {
|
|
1074
|
+
expect(canvas.getAllByRole("combobox").length).toBeGreaterThanOrEqual(2);
|
|
1075
|
+
}, {
|
|
1076
|
+
timeout: 3000
|
|
1077
|
+
});
|
|
1078
|
+
case 1:
|
|
1079
|
+
blockStyleSelect = canvas.getAllByRole("combobox")[1];
|
|
1080
|
+
_context29.n = 2;
|
|
1081
|
+
return userEvent.click(blockStyleSelect);
|
|
1082
|
+
case 2:
|
|
1083
|
+
_context29.n = 3;
|
|
1084
|
+
return waitFor(function () {
|
|
1085
|
+
var body = within(document.body);
|
|
1086
|
+
expect(body.getByText("List Large")).toBeInTheDocument();
|
|
1087
|
+
expect(body.getByText("List Small")).toBeInTheDocument();
|
|
1088
|
+
expect(body.getByText("Universal")).toBeInTheDocument();
|
|
1089
|
+
expect(body.queryByText("Intro Text")).not.toBeInTheDocument();
|
|
1090
|
+
expect(body.queryByText("Numbered Style")).not.toBeInTheDocument();
|
|
1091
|
+
}, {
|
|
1092
|
+
timeout: 3000
|
|
1093
|
+
});
|
|
1094
|
+
case 3:
|
|
1095
|
+
_context29.n = 4;
|
|
1096
|
+
return userEvent.keyboard("{Escape}");
|
|
1097
|
+
case 4:
|
|
1098
|
+
return _context29.a(2);
|
|
1099
|
+
}
|
|
1100
|
+
}, _callee29);
|
|
1101
|
+
})));
|
|
1102
|
+
case 5:
|
|
1103
|
+
_context34.n = 6;
|
|
1104
|
+
return step("Switch to ordered list via keyboard shortcut", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee30() {
|
|
1105
|
+
var editor, mod;
|
|
1106
|
+
return _regenerator().w(function (_context30) {
|
|
1107
|
+
while (1) switch (_context30.n) {
|
|
1108
|
+
case 0:
|
|
1109
|
+
editor = canvas.getByRole("textbox");
|
|
1110
|
+
_context30.n = 1;
|
|
1111
|
+
return userEvent.click(editor);
|
|
1112
|
+
case 1:
|
|
1113
|
+
mod = /Mac/i.test(navigator.platform) ? "Meta" : "Control";
|
|
1114
|
+
_context30.n = 2;
|
|
1115
|
+
return userEvent.keyboard("{".concat(mod, ">}{Shift>}7{/Shift}{/").concat(mod, "}"));
|
|
1116
|
+
case 2:
|
|
1117
|
+
_context30.n = 3;
|
|
1118
|
+
return waitFor(function () {
|
|
1119
|
+
expect(editor.querySelector("ol")).toBeTruthy();
|
|
1120
|
+
}, {
|
|
1121
|
+
timeout: 3000
|
|
1122
|
+
});
|
|
1123
|
+
case 3:
|
|
1124
|
+
return _context30.a(2);
|
|
1125
|
+
}
|
|
1126
|
+
}, _callee30);
|
|
1127
|
+
})));
|
|
1128
|
+
case 6:
|
|
1129
|
+
_context34.n = 7;
|
|
1130
|
+
return step("Ordered list mode: block style dropdown includes OL-only style", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee31() {
|
|
1131
|
+
var blockStyleSelect;
|
|
1132
|
+
return _regenerator().w(function (_context31) {
|
|
1133
|
+
while (1) switch (_context31.n) {
|
|
1134
|
+
case 0:
|
|
1135
|
+
blockStyleSelect = canvas.getAllByRole("combobox")[1];
|
|
1136
|
+
_context31.n = 1;
|
|
1137
|
+
return userEvent.click(blockStyleSelect);
|
|
1138
|
+
case 1:
|
|
1139
|
+
_context31.n = 2;
|
|
1140
|
+
return waitFor(function () {
|
|
1141
|
+
var body = within(document.body);
|
|
1142
|
+
expect(body.getByText("List Large")).toBeInTheDocument();
|
|
1143
|
+
expect(body.getByText("List Small")).toBeInTheDocument();
|
|
1144
|
+
expect(body.getByText("Universal")).toBeInTheDocument();
|
|
1145
|
+
expect(body.getByText("Numbered Style")).toBeInTheDocument();
|
|
1146
|
+
expect(body.queryByText("Intro Text")).not.toBeInTheDocument();
|
|
1147
|
+
}, {
|
|
1148
|
+
timeout: 3000
|
|
1149
|
+
});
|
|
1150
|
+
case 2:
|
|
1151
|
+
_context31.n = 3;
|
|
1152
|
+
return userEvent.keyboard("{Escape}");
|
|
1153
|
+
case 3:
|
|
1154
|
+
return _context31.a(2);
|
|
1155
|
+
}
|
|
1156
|
+
}, _callee31);
|
|
1157
|
+
})));
|
|
1158
|
+
case 7:
|
|
1159
|
+
_context34.n = 8;
|
|
1160
|
+
return step("Select 'List Large' style", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee32() {
|
|
1161
|
+
var blockStyleSelect;
|
|
1162
|
+
return _regenerator().w(function (_context32) {
|
|
1163
|
+
while (1) switch (_context32.n) {
|
|
1164
|
+
case 0:
|
|
1165
|
+
blockStyleSelect = canvas.getAllByRole("combobox")[1];
|
|
1166
|
+
_context32.n = 1;
|
|
1167
|
+
return userEvent.click(blockStyleSelect);
|
|
1168
|
+
case 1:
|
|
1169
|
+
_context32.n = 2;
|
|
1170
|
+
return waitFor(function () {
|
|
1171
|
+
expect(within(document.body).getByText("List Large")).toBeInTheDocument();
|
|
1172
|
+
}, {
|
|
1173
|
+
timeout: 3000
|
|
1174
|
+
});
|
|
1175
|
+
case 2:
|
|
1176
|
+
_context32.n = 3;
|
|
1177
|
+
return userEvent.click(within(document.body).getByText("List Large"));
|
|
1178
|
+
case 3:
|
|
1179
|
+
_context32.n = 4;
|
|
1180
|
+
return waitFor(function () {
|
|
1181
|
+
expect(canvas.getAllByRole("combobox")[1]).toHaveTextContent("List Large");
|
|
1182
|
+
}, {
|
|
1183
|
+
timeout: 3000
|
|
1184
|
+
});
|
|
1185
|
+
case 4:
|
|
1186
|
+
return _context32.a(2);
|
|
1187
|
+
}
|
|
1188
|
+
}, _callee32);
|
|
1189
|
+
})));
|
|
1190
|
+
case 8:
|
|
1191
|
+
_context34.n = 9;
|
|
1192
|
+
return step("Verify 'list-large' block style attribute is applied in the editor", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee33() {
|
|
1193
|
+
return _regenerator().w(function (_context33) {
|
|
1194
|
+
while (1) switch (_context33.n) {
|
|
1195
|
+
case 0:
|
|
1196
|
+
_context33.n = 1;
|
|
1197
|
+
return waitFor(function () {
|
|
1198
|
+
var styledEl = document.querySelector('[data-block-style="list-large"]');
|
|
1199
|
+
expect(styledEl).toBeTruthy();
|
|
1200
|
+
}, {
|
|
1201
|
+
timeout: 3000
|
|
1202
|
+
});
|
|
1203
|
+
case 1:
|
|
1204
|
+
return _context33.a(2);
|
|
1205
|
+
}
|
|
1206
|
+
}, _callee33);
|
|
1207
|
+
})));
|
|
1208
|
+
case 9:
|
|
1209
|
+
return _context34.a(2);
|
|
1210
|
+
}
|
|
1211
|
+
}, _callee34);
|
|
1212
|
+
}));
|
|
1213
|
+
function play(_x7) {
|
|
1214
|
+
return _play7.apply(this, arguments);
|
|
1215
|
+
}
|
|
1216
|
+
return play;
|
|
1217
|
+
}()
|
|
1218
|
+
};
|
|
1219
|
+
var MaxBlocksBlock = createTipTapRichTextBlock({
|
|
1220
|
+
maxBlocks: 2
|
|
1221
|
+
});
|
|
1222
|
+
function MaxBlocksStory() {
|
|
1223
|
+
var _useState13 = useState(MaxBlocksBlock.defaultValues()),
|
|
1224
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
1225
|
+
state = _useState14[0],
|
|
1226
|
+
setState = _useState14[1];
|
|
1227
|
+
return /*#__PURE__*/_jsx(StoryWrapper, {
|
|
1228
|
+
state: state,
|
|
1229
|
+
children: /*#__PURE__*/_jsx(MaxBlocksBlock.AdminComponent, {
|
|
1230
|
+
state: state,
|
|
1231
|
+
updateState: setState
|
|
1232
|
+
})
|
|
1233
|
+
});
|
|
1234
|
+
}
|
|
1235
|
+
export var MaxBlocks = {
|
|
1236
|
+
render: function render() {
|
|
1237
|
+
return /*#__PURE__*/_jsx(MaxBlocksStory, {});
|
|
1238
|
+
},
|
|
1239
|
+
play: function () {
|
|
1240
|
+
var _play8 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee38(_ref37) {
|
|
1241
|
+
var canvas, userEvent, step;
|
|
1242
|
+
return _regenerator().w(function (_context38) {
|
|
1243
|
+
while (1) switch (_context38.n) {
|
|
1244
|
+
case 0:
|
|
1245
|
+
canvas = _ref37.canvas, userEvent = _ref37.userEvent, step = _ref37.step;
|
|
1246
|
+
_context38.n = 1;
|
|
1247
|
+
return step("Editor is ready", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee35() {
|
|
1248
|
+
return _regenerator().w(function (_context35) {
|
|
1249
|
+
while (1) switch (_context35.n) {
|
|
1250
|
+
case 0:
|
|
1251
|
+
_context35.n = 1;
|
|
1252
|
+
return waitFor(function () {
|
|
1253
|
+
expect(canvas.getByRole("textbox")).toBeInTheDocument();
|
|
1254
|
+
}, {
|
|
1255
|
+
timeout: 5000
|
|
1256
|
+
});
|
|
1257
|
+
case 1:
|
|
1258
|
+
return _context35.a(2);
|
|
1259
|
+
}
|
|
1260
|
+
}, _callee35);
|
|
1261
|
+
})));
|
|
1262
|
+
case 1:
|
|
1263
|
+
_context38.n = 2;
|
|
1264
|
+
return step("Type text and press Enter to create blocks", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee36() {
|
|
1265
|
+
var editor;
|
|
1266
|
+
return _regenerator().w(function (_context36) {
|
|
1267
|
+
while (1) switch (_context36.n) {
|
|
1268
|
+
case 0:
|
|
1269
|
+
editor = canvas.getByRole("textbox");
|
|
1270
|
+
_context36.n = 1;
|
|
1271
|
+
return userEvent.click(editor);
|
|
1272
|
+
case 1:
|
|
1273
|
+
_context36.n = 2;
|
|
1274
|
+
return userEvent.keyboard("First block");
|
|
1275
|
+
case 2:
|
|
1276
|
+
_context36.n = 3;
|
|
1277
|
+
return userEvent.keyboard("{Enter}");
|
|
1278
|
+
case 3:
|
|
1279
|
+
_context36.n = 4;
|
|
1280
|
+
return userEvent.keyboard("Second block");
|
|
1281
|
+
case 4:
|
|
1282
|
+
_context36.n = 5;
|
|
1283
|
+
return waitFor(function () {
|
|
1284
|
+
expect(editor).toHaveTextContent("First block");
|
|
1285
|
+
expect(editor).toHaveTextContent("Second block");
|
|
1286
|
+
}, {
|
|
1287
|
+
timeout: 3000
|
|
1288
|
+
});
|
|
1289
|
+
case 5:
|
|
1290
|
+
return _context36.a(2);
|
|
1291
|
+
}
|
|
1292
|
+
}, _callee36);
|
|
1293
|
+
})));
|
|
1294
|
+
case 2:
|
|
1295
|
+
_context38.n = 3;
|
|
1296
|
+
return step("Third Enter does not create a new block (maxBlocks=2 enforced)", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee37() {
|
|
1297
|
+
var editor;
|
|
1298
|
+
return _regenerator().w(function (_context37) {
|
|
1299
|
+
while (1) switch (_context37.n) {
|
|
1300
|
+
case 0:
|
|
1301
|
+
editor = canvas.getByRole("textbox");
|
|
1302
|
+
_context37.n = 1;
|
|
1303
|
+
return userEvent.keyboard("{Enter}");
|
|
1304
|
+
case 1:
|
|
1305
|
+
_context37.n = 2;
|
|
1306
|
+
return userEvent.keyboard("Third block");
|
|
1307
|
+
case 2:
|
|
1308
|
+
_context37.n = 3;
|
|
1309
|
+
return waitFor(function () {
|
|
1310
|
+
// Should still only have 2 paragraphs in the output
|
|
1311
|
+
var paragraphs = editor.querySelectorAll("p");
|
|
1312
|
+
expect(paragraphs.length).toBeLessThanOrEqual(2);
|
|
1313
|
+
}, {
|
|
1314
|
+
timeout: 3000
|
|
1315
|
+
});
|
|
1316
|
+
case 3:
|
|
1317
|
+
return _context37.a(2);
|
|
1318
|
+
}
|
|
1319
|
+
}, _callee37);
|
|
1320
|
+
})));
|
|
1321
|
+
case 3:
|
|
1322
|
+
return _context38.a(2);
|
|
1323
|
+
}
|
|
1324
|
+
}, _callee38);
|
|
1325
|
+
}));
|
|
1326
|
+
function play(_x8) {
|
|
1327
|
+
return _play8.apply(this, arguments);
|
|
1328
|
+
}
|
|
1329
|
+
return play;
|
|
1330
|
+
}()
|
|
1331
|
+
};
|
|
1332
|
+
var InlineStylesBlock = createTipTapRichTextBlock({
|
|
1333
|
+
inlineStyles: [{
|
|
1334
|
+
name: "highlight",
|
|
1335
|
+
label: "Highlight",
|
|
1336
|
+
element: function element(props) {
|
|
1337
|
+
return /*#__PURE__*/_jsx("span", _objectSpread({
|
|
1338
|
+
style: {
|
|
1339
|
+
backgroundColor: "#fff3cd",
|
|
1340
|
+
padding: "0 2px"
|
|
1341
|
+
}
|
|
1342
|
+
}, props));
|
|
1343
|
+
}
|
|
1344
|
+
}, {
|
|
1345
|
+
name: "tag",
|
|
1346
|
+
label: "Tag",
|
|
1347
|
+
element: function element(props) {
|
|
1348
|
+
return /*#__PURE__*/_jsx("span", _objectSpread({
|
|
1349
|
+
style: {
|
|
1350
|
+
backgroundColor: "#e0f0ff",
|
|
1351
|
+
color: "#0066cc",
|
|
1352
|
+
padding: "0 4px",
|
|
1353
|
+
borderRadius: 4
|
|
1354
|
+
}
|
|
1355
|
+
}, props));
|
|
1356
|
+
}
|
|
1357
|
+
}]
|
|
1358
|
+
});
|
|
1359
|
+
function InlineStylesStory() {
|
|
1360
|
+
var _useState15 = useState(InlineStylesBlock.defaultValues()),
|
|
1361
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
1362
|
+
state = _useState16[0],
|
|
1363
|
+
setState = _useState16[1];
|
|
1364
|
+
return /*#__PURE__*/_jsx(StoryWrapper, {
|
|
1365
|
+
state: state,
|
|
1366
|
+
children: /*#__PURE__*/_jsx(InlineStylesBlock.AdminComponent, {
|
|
1367
|
+
state: state,
|
|
1368
|
+
updateState: setState
|
|
1369
|
+
})
|
|
1370
|
+
});
|
|
1371
|
+
}
|
|
1372
|
+
export var InlineStyles = {
|
|
1373
|
+
render: function render() {
|
|
1374
|
+
return /*#__PURE__*/_jsx(InlineStylesStory, {});
|
|
1375
|
+
},
|
|
1376
|
+
play: function () {
|
|
1377
|
+
var _play9 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee46(_ref41) {
|
|
1378
|
+
var canvas, userEvent, step;
|
|
1379
|
+
return _regenerator().w(function (_context46) {
|
|
1380
|
+
while (1) switch (_context46.n) {
|
|
1381
|
+
case 0:
|
|
1382
|
+
canvas = _ref41.canvas, userEvent = _ref41.userEvent, step = _ref41.step;
|
|
1383
|
+
_context46.n = 1;
|
|
1384
|
+
return step("Editor is ready", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee39() {
|
|
1385
|
+
var comboboxes;
|
|
1386
|
+
return _regenerator().w(function (_context39) {
|
|
1387
|
+
while (1) switch (_context39.n) {
|
|
1388
|
+
case 0:
|
|
1389
|
+
_context39.n = 1;
|
|
1390
|
+
return waitFor(function () {
|
|
1391
|
+
expect(canvas.getByRole("textbox")).toBeInTheDocument();
|
|
1392
|
+
}, {
|
|
1393
|
+
timeout: 5000
|
|
1394
|
+
});
|
|
1395
|
+
case 1:
|
|
1396
|
+
// Heading select + inline style select
|
|
1397
|
+
comboboxes = canvas.getAllByRole("combobox");
|
|
1398
|
+
expect(comboboxes).toHaveLength(2);
|
|
1399
|
+
case 2:
|
|
1400
|
+
return _context39.a(2);
|
|
1401
|
+
}
|
|
1402
|
+
}, _callee39);
|
|
1403
|
+
})));
|
|
1404
|
+
case 1:
|
|
1405
|
+
_context46.n = 2;
|
|
1406
|
+
return step("Type text and select it", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee40() {
|
|
1407
|
+
var editor, range, selection;
|
|
1408
|
+
return _regenerator().w(function (_context40) {
|
|
1409
|
+
while (1) switch (_context40.n) {
|
|
1410
|
+
case 0:
|
|
1411
|
+
editor = canvas.getByRole("textbox");
|
|
1412
|
+
_context40.n = 1;
|
|
1413
|
+
return userEvent.click(editor);
|
|
1414
|
+
case 1:
|
|
1415
|
+
_context40.n = 2;
|
|
1416
|
+
return userEvent.keyboard("hello");
|
|
1417
|
+
case 2:
|
|
1418
|
+
_context40.n = 3;
|
|
1419
|
+
return waitFor(function () {
|
|
1420
|
+
expect(editor).toHaveTextContent("hello");
|
|
1421
|
+
}, {
|
|
1422
|
+
timeout: 3000
|
|
1423
|
+
});
|
|
1424
|
+
case 3:
|
|
1425
|
+
// userEvent's Shift+Home isn't supported in contenteditable; use the native Selection API.
|
|
1426
|
+
range = document.createRange();
|
|
1427
|
+
range.selectNodeContents(editor);
|
|
1428
|
+
selection = window.getSelection();
|
|
1429
|
+
selection === null || selection === void 0 || selection.removeAllRanges();
|
|
1430
|
+
selection === null || selection === void 0 || selection.addRange(range);
|
|
1431
|
+
|
|
1432
|
+
// Wait for the inline-style dropdown to enable (TipTap picks up selection via the selectionchange event).
|
|
1433
|
+
_context40.n = 4;
|
|
1434
|
+
return waitFor(function () {
|
|
1435
|
+
expect(canvas.getAllByRole("combobox")[1]).not.toBeDisabled();
|
|
1436
|
+
}, {
|
|
1437
|
+
timeout: 3000
|
|
1438
|
+
});
|
|
1439
|
+
case 4:
|
|
1440
|
+
return _context40.a(2);
|
|
1441
|
+
}
|
|
1442
|
+
}, _callee40);
|
|
1443
|
+
})));
|
|
1444
|
+
case 2:
|
|
1445
|
+
_context46.n = 3;
|
|
1446
|
+
return step("Apply 'Highlight' inline style", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee41() {
|
|
1447
|
+
var inlineStyleSelect;
|
|
1448
|
+
return _regenerator().w(function (_context41) {
|
|
1449
|
+
while (1) switch (_context41.n) {
|
|
1450
|
+
case 0:
|
|
1451
|
+
inlineStyleSelect = canvas.getAllByRole("combobox")[1];
|
|
1452
|
+
_context41.n = 1;
|
|
1453
|
+
return userEvent.click(inlineStyleSelect);
|
|
1454
|
+
case 1:
|
|
1455
|
+
_context41.n = 2;
|
|
1456
|
+
return waitFor(function () {
|
|
1457
|
+
expect(within(document.body).getByRole("option", {
|
|
1458
|
+
name: "Highlight"
|
|
1459
|
+
})).toBeInTheDocument();
|
|
1460
|
+
}, {
|
|
1461
|
+
timeout: 3000
|
|
1462
|
+
});
|
|
1463
|
+
case 2:
|
|
1464
|
+
_context41.n = 3;
|
|
1465
|
+
return userEvent.click(within(document.body).getByRole("option", {
|
|
1466
|
+
name: "Highlight"
|
|
1467
|
+
}));
|
|
1468
|
+
case 3:
|
|
1469
|
+
_context41.n = 4;
|
|
1470
|
+
return waitFor(function () {
|
|
1471
|
+
expect(canvas.getAllByRole("combobox")[1]).toHaveTextContent("Highlight");
|
|
1472
|
+
}, {
|
|
1473
|
+
timeout: 3000
|
|
1474
|
+
});
|
|
1475
|
+
case 4:
|
|
1476
|
+
return _context41.a(2);
|
|
1477
|
+
}
|
|
1478
|
+
}, _callee41);
|
|
1479
|
+
})));
|
|
1480
|
+
case 3:
|
|
1481
|
+
_context46.n = 4;
|
|
1482
|
+
return step("Verify highlight element (from `element` prop) is rendered with its styling", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee42() {
|
|
1483
|
+
return _regenerator().w(function (_context42) {
|
|
1484
|
+
while (1) switch (_context42.n) {
|
|
1485
|
+
case 0:
|
|
1486
|
+
_context42.n = 1;
|
|
1487
|
+
return waitFor(function () {
|
|
1488
|
+
var styledEl = document.querySelector('[data-inline-style="highlight"]');
|
|
1489
|
+
expect(styledEl).toBeTruthy();
|
|
1490
|
+
expect(styledEl).toHaveTextContent("hello");
|
|
1491
|
+
expect(styledEl).toHaveStyle({
|
|
1492
|
+
backgroundColor: "rgb(255, 243, 205)"
|
|
1493
|
+
});
|
|
1494
|
+
}, {
|
|
1495
|
+
timeout: 3000
|
|
1496
|
+
});
|
|
1497
|
+
case 1:
|
|
1498
|
+
return _context42.a(2);
|
|
1499
|
+
}
|
|
1500
|
+
}, _callee42);
|
|
1501
|
+
})));
|
|
1502
|
+
case 4:
|
|
1503
|
+
_context46.n = 5;
|
|
1504
|
+
return step("Switch to 'Tag' inline style", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee43() {
|
|
1505
|
+
var inlineStyleSelect;
|
|
1506
|
+
return _regenerator().w(function (_context43) {
|
|
1507
|
+
while (1) switch (_context43.n) {
|
|
1508
|
+
case 0:
|
|
1509
|
+
inlineStyleSelect = canvas.getAllByRole("combobox")[1];
|
|
1510
|
+
_context43.n = 1;
|
|
1511
|
+
return userEvent.click(inlineStyleSelect);
|
|
1512
|
+
case 1:
|
|
1513
|
+
_context43.n = 2;
|
|
1514
|
+
return waitFor(function () {
|
|
1515
|
+
expect(within(document.body).getByRole("option", {
|
|
1516
|
+
name: "Tag"
|
|
1517
|
+
})).toBeInTheDocument();
|
|
1518
|
+
}, {
|
|
1519
|
+
timeout: 3000
|
|
1520
|
+
});
|
|
1521
|
+
case 2:
|
|
1522
|
+
_context43.n = 3;
|
|
1523
|
+
return userEvent.click(within(document.body).getByRole("option", {
|
|
1524
|
+
name: "Tag"
|
|
1525
|
+
}));
|
|
1526
|
+
case 3:
|
|
1527
|
+
return _context43.a(2);
|
|
1528
|
+
}
|
|
1529
|
+
}, _callee43);
|
|
1530
|
+
})));
|
|
1531
|
+
case 5:
|
|
1532
|
+
_context46.n = 6;
|
|
1533
|
+
return step("Verify tag element replaces the highlight element", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee44() {
|
|
1534
|
+
return _regenerator().w(function (_context44) {
|
|
1535
|
+
while (1) switch (_context44.n) {
|
|
1536
|
+
case 0:
|
|
1537
|
+
_context44.n = 1;
|
|
1538
|
+
return waitFor(function () {
|
|
1539
|
+
expect(document.querySelector('[data-inline-style="highlight"]')).toBeNull();
|
|
1540
|
+
var tagEl = document.querySelector('[data-inline-style="tag"]');
|
|
1541
|
+
expect(tagEl).toBeTruthy();
|
|
1542
|
+
expect(tagEl).toHaveTextContent("hello");
|
|
1543
|
+
expect(tagEl).toHaveStyle({
|
|
1544
|
+
backgroundColor: "rgb(224, 240, 255)",
|
|
1545
|
+
color: "rgb(0, 102, 204)"
|
|
1546
|
+
});
|
|
1547
|
+
}, {
|
|
1548
|
+
timeout: 3000
|
|
1549
|
+
});
|
|
1550
|
+
case 1:
|
|
1551
|
+
return _context44.a(2);
|
|
1552
|
+
}
|
|
1553
|
+
}, _callee44);
|
|
1554
|
+
})));
|
|
1555
|
+
case 6:
|
|
1556
|
+
_context46.n = 7;
|
|
1557
|
+
return step("Clear inline style resets to default rendering", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee45() {
|
|
1558
|
+
var inlineStyleSelect;
|
|
1559
|
+
return _regenerator().w(function (_context45) {
|
|
1560
|
+
while (1) switch (_context45.n) {
|
|
1561
|
+
case 0:
|
|
1562
|
+
inlineStyleSelect = canvas.getAllByRole("combobox")[1];
|
|
1563
|
+
_context45.n = 1;
|
|
1564
|
+
return userEvent.click(inlineStyleSelect);
|
|
1565
|
+
case 1:
|
|
1566
|
+
_context45.n = 2;
|
|
1567
|
+
return waitFor(function () {
|
|
1568
|
+
expect(within(document.body).getByRole("option", {
|
|
1569
|
+
name: "Default"
|
|
1570
|
+
})).toBeInTheDocument();
|
|
1571
|
+
}, {
|
|
1572
|
+
timeout: 3000
|
|
1573
|
+
});
|
|
1574
|
+
case 2:
|
|
1575
|
+
_context45.n = 3;
|
|
1576
|
+
return userEvent.click(within(document.body).getByRole("option", {
|
|
1577
|
+
name: "Default"
|
|
1578
|
+
}));
|
|
1579
|
+
case 3:
|
|
1580
|
+
_context45.n = 4;
|
|
1581
|
+
return waitFor(function () {
|
|
1582
|
+
expect(document.querySelector("[data-inline-style]")).toBeNull();
|
|
1583
|
+
}, {
|
|
1584
|
+
timeout: 3000
|
|
1585
|
+
});
|
|
1586
|
+
case 4:
|
|
1587
|
+
return _context45.a(2);
|
|
1588
|
+
}
|
|
1589
|
+
}, _callee45);
|
|
1590
|
+
})));
|
|
1591
|
+
case 7:
|
|
1592
|
+
return _context46.a(2);
|
|
1593
|
+
}
|
|
1594
|
+
}, _callee46);
|
|
1595
|
+
}));
|
|
1596
|
+
function play(_x9) {
|
|
1597
|
+
return _play9.apply(this, arguments);
|
|
1598
|
+
}
|
|
1599
|
+
return play;
|
|
1600
|
+
}()
|
|
1601
|
+
};
|
|
1602
|
+
var ListLevelMaxBlock = createTipTapRichTextBlock({
|
|
1603
|
+
listLevelMax: 2
|
|
1604
|
+
});
|
|
1605
|
+
function ListLevelMaxStory() {
|
|
1606
|
+
var _useState17 = useState(ListLevelMaxBlock.defaultValues()),
|
|
1607
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
1608
|
+
state = _useState18[0],
|
|
1609
|
+
setState = _useState18[1];
|
|
1610
|
+
return /*#__PURE__*/_jsx(StoryWrapper, {
|
|
1611
|
+
state: state,
|
|
1612
|
+
children: /*#__PURE__*/_jsx(ListLevelMaxBlock.AdminComponent, {
|
|
1613
|
+
state: state,
|
|
1614
|
+
updateState: setState
|
|
1615
|
+
})
|
|
1616
|
+
});
|
|
1617
|
+
}
|
|
1618
|
+
export var ListLevelMax = {
|
|
1619
|
+
render: function render() {
|
|
1620
|
+
return /*#__PURE__*/_jsx(ListLevelMaxStory, {});
|
|
1621
|
+
},
|
|
1622
|
+
play: function () {
|
|
1623
|
+
var _play0 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee51(_ref49) {
|
|
1624
|
+
var canvas, userEvent, step;
|
|
1625
|
+
return _regenerator().w(function (_context51) {
|
|
1626
|
+
while (1) switch (_context51.n) {
|
|
1627
|
+
case 0:
|
|
1628
|
+
canvas = _ref49.canvas, userEvent = _ref49.userEvent, step = _ref49.step;
|
|
1629
|
+
_context51.n = 1;
|
|
1630
|
+
return step("Editor is ready", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee47() {
|
|
1631
|
+
return _regenerator().w(function (_context47) {
|
|
1632
|
+
while (1) switch (_context47.n) {
|
|
1633
|
+
case 0:
|
|
1634
|
+
_context47.n = 1;
|
|
1635
|
+
return waitFor(function () {
|
|
1636
|
+
expect(canvas.getByRole("textbox")).toBeInTheDocument();
|
|
1637
|
+
}, {
|
|
1638
|
+
timeout: 5000
|
|
1639
|
+
});
|
|
1640
|
+
case 1:
|
|
1641
|
+
return _context47.a(2);
|
|
1642
|
+
}
|
|
1643
|
+
}, _callee47);
|
|
1644
|
+
})));
|
|
1645
|
+
case 1:
|
|
1646
|
+
_context51.n = 2;
|
|
1647
|
+
return step("Create a bullet list", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee48() {
|
|
1648
|
+
var editor, mod;
|
|
1649
|
+
return _regenerator().w(function (_context48) {
|
|
1650
|
+
while (1) switch (_context48.n) {
|
|
1651
|
+
case 0:
|
|
1652
|
+
editor = canvas.getByRole("textbox");
|
|
1653
|
+
_context48.n = 1;
|
|
1654
|
+
return userEvent.click(editor);
|
|
1655
|
+
case 1:
|
|
1656
|
+
_context48.n = 2;
|
|
1657
|
+
return userEvent.keyboard("Item 1");
|
|
1658
|
+
case 2:
|
|
1659
|
+
// Toggle bullet list using keyboard shortcut
|
|
1660
|
+
mod = /Mac/i.test(navigator.platform) ? "Meta" : "Control";
|
|
1661
|
+
_context48.n = 3;
|
|
1662
|
+
return userEvent.keyboard("{".concat(mod, ">}{Shift>}8{/Shift}{/").concat(mod, "}"));
|
|
1663
|
+
case 3:
|
|
1664
|
+
_context48.n = 4;
|
|
1665
|
+
return waitFor(function () {
|
|
1666
|
+
expect(editor.querySelector("ul")).toBeTruthy();
|
|
1667
|
+
}, {
|
|
1668
|
+
timeout: 3000
|
|
1669
|
+
});
|
|
1670
|
+
case 4:
|
|
1671
|
+
return _context48.a(2);
|
|
1672
|
+
}
|
|
1673
|
+
}, _callee48);
|
|
1674
|
+
})));
|
|
1675
|
+
case 2:
|
|
1676
|
+
_context51.n = 3;
|
|
1677
|
+
return step("Create a second list item and indent it (allowed, depth 2)", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee49() {
|
|
1678
|
+
var editor;
|
|
1679
|
+
return _regenerator().w(function (_context49) {
|
|
1680
|
+
while (1) switch (_context49.n) {
|
|
1681
|
+
case 0:
|
|
1682
|
+
editor = canvas.getByRole("textbox");
|
|
1683
|
+
_context49.n = 1;
|
|
1684
|
+
return userEvent.keyboard("{Enter}");
|
|
1685
|
+
case 1:
|
|
1686
|
+
_context49.n = 2;
|
|
1687
|
+
return userEvent.keyboard("Item 2");
|
|
1688
|
+
case 2:
|
|
1689
|
+
_context49.n = 3;
|
|
1690
|
+
return userEvent.keyboard("{Tab}");
|
|
1691
|
+
case 3:
|
|
1692
|
+
_context49.n = 4;
|
|
1693
|
+
return waitFor(function () {
|
|
1694
|
+
// Should have nested ul (depth 2)
|
|
1695
|
+
var nestedUl = editor.querySelector("ul ul");
|
|
1696
|
+
expect(nestedUl).toBeTruthy();
|
|
1697
|
+
}, {
|
|
1698
|
+
timeout: 3000
|
|
1699
|
+
});
|
|
1700
|
+
case 4:
|
|
1701
|
+
return _context49.a(2);
|
|
1702
|
+
}
|
|
1703
|
+
}, _callee49);
|
|
1704
|
+
})));
|
|
1705
|
+
case 3:
|
|
1706
|
+
_context51.n = 4;
|
|
1707
|
+
return step("Try to indent further (should be blocked, depth would exceed 2)", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee50() {
|
|
1708
|
+
var editor;
|
|
1709
|
+
return _regenerator().w(function (_context50) {
|
|
1710
|
+
while (1) switch (_context50.n) {
|
|
1711
|
+
case 0:
|
|
1712
|
+
editor = canvas.getByRole("textbox");
|
|
1713
|
+
_context50.n = 1;
|
|
1714
|
+
return userEvent.keyboard("{Enter}");
|
|
1715
|
+
case 1:
|
|
1716
|
+
_context50.n = 2;
|
|
1717
|
+
return userEvent.keyboard("Item 3");
|
|
1718
|
+
case 2:
|
|
1719
|
+
_context50.n = 3;
|
|
1720
|
+
return userEvent.keyboard("{Tab}");
|
|
1721
|
+
case 3:
|
|
1722
|
+
_context50.n = 4;
|
|
1723
|
+
return waitFor(function () {
|
|
1724
|
+
// Should NOT have triple-nested ul (depth 3 not allowed)
|
|
1725
|
+
var tripleNestedUl = editor.querySelector("ul ul ul");
|
|
1726
|
+
expect(tripleNestedUl).toBeNull();
|
|
1727
|
+
}, {
|
|
1728
|
+
timeout: 3000
|
|
1729
|
+
});
|
|
1730
|
+
case 4:
|
|
1731
|
+
return _context50.a(2);
|
|
1732
|
+
}
|
|
1733
|
+
}, _callee50);
|
|
1734
|
+
})));
|
|
1735
|
+
case 4:
|
|
1736
|
+
return _context51.a(2);
|
|
1737
|
+
}
|
|
1738
|
+
}, _callee51);
|
|
1739
|
+
}));
|
|
1740
|
+
function play(_x0) {
|
|
1741
|
+
return _play0.apply(this, arguments);
|
|
1742
|
+
}
|
|
1743
|
+
return play;
|
|
1744
|
+
}()
|
|
1745
|
+
};
|
|
1746
|
+
var CombinedStylesBlock = createTipTapRichTextBlock({
|
|
1747
|
+
blockStyles: [{
|
|
1748
|
+
name: "intro",
|
|
1749
|
+
label: "Intro Text",
|
|
1750
|
+
appliesTo: ["paragraph"],
|
|
1751
|
+
element: function element(props) {
|
|
1752
|
+
return /*#__PURE__*/_jsx("p", _objectSpread({
|
|
1753
|
+
style: {
|
|
1754
|
+
fontSize: 20,
|
|
1755
|
+
fontStyle: "italic"
|
|
1756
|
+
}
|
|
1757
|
+
}, props));
|
|
1758
|
+
}
|
|
1759
|
+
}],
|
|
1760
|
+
inlineStyles: [{
|
|
1761
|
+
name: "highlight",
|
|
1762
|
+
label: "Highlight",
|
|
1763
|
+
element: function element(props) {
|
|
1764
|
+
return /*#__PURE__*/_jsx("span", _objectSpread({
|
|
1765
|
+
style: {
|
|
1766
|
+
backgroundColor: "#fff3cd",
|
|
1767
|
+
padding: "0 2px"
|
|
1768
|
+
}
|
|
1769
|
+
}, props));
|
|
1770
|
+
}
|
|
1771
|
+
}, {
|
|
1772
|
+
name: "tag",
|
|
1773
|
+
label: "Tag",
|
|
1774
|
+
element: function element(props) {
|
|
1775
|
+
return /*#__PURE__*/_jsx("span", _objectSpread({
|
|
1776
|
+
style: {
|
|
1777
|
+
backgroundColor: "#e0f0ff",
|
|
1778
|
+
color: "#0066cc",
|
|
1779
|
+
padding: "0 4px",
|
|
1780
|
+
borderRadius: 4
|
|
1781
|
+
}
|
|
1782
|
+
}, props));
|
|
1783
|
+
}
|
|
1784
|
+
}]
|
|
1785
|
+
});
|
|
1786
|
+
function CombinedStylesStory() {
|
|
1787
|
+
var _useState19 = useState(CombinedStylesBlock.defaultValues()),
|
|
1788
|
+
_useState20 = _slicedToArray(_useState19, 2),
|
|
1789
|
+
state = _useState20[0],
|
|
1790
|
+
setState = _useState20[1];
|
|
1791
|
+
return /*#__PURE__*/_jsx(StoryWrapper, {
|
|
1792
|
+
state: state,
|
|
1793
|
+
children: /*#__PURE__*/_jsx(CombinedStylesBlock.AdminComponent, {
|
|
1794
|
+
state: state,
|
|
1795
|
+
updateState: setState
|
|
1796
|
+
})
|
|
1797
|
+
});
|
|
1798
|
+
}
|
|
1799
|
+
export var CombinedBlockAndInlineStyles = {
|
|
1800
|
+
render: function render() {
|
|
1801
|
+
return /*#__PURE__*/_jsx(CombinedStylesStory, {});
|
|
1802
|
+
},
|
|
1803
|
+
play: function () {
|
|
1804
|
+
var _play1 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee53(_ref54) {
|
|
1805
|
+
var canvas, step;
|
|
1806
|
+
return _regenerator().w(function (_context53) {
|
|
1807
|
+
while (1) switch (_context53.n) {
|
|
1808
|
+
case 0:
|
|
1809
|
+
canvas = _ref54.canvas, step = _ref54.step;
|
|
1810
|
+
_context53.n = 1;
|
|
1811
|
+
return step("Editor is ready with both block style and inline style dropdowns", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee52() {
|
|
1812
|
+
var comboboxes;
|
|
1813
|
+
return _regenerator().w(function (_context52) {
|
|
1814
|
+
while (1) switch (_context52.n) {
|
|
1815
|
+
case 0:
|
|
1816
|
+
_context52.n = 1;
|
|
1817
|
+
return waitFor(function () {
|
|
1818
|
+
expect(canvas.getByRole("textbox")).toBeInTheDocument();
|
|
1819
|
+
}, {
|
|
1820
|
+
timeout: 5000
|
|
1821
|
+
});
|
|
1822
|
+
case 1:
|
|
1823
|
+
// Heading select + block style select + inline style select
|
|
1824
|
+
comboboxes = canvas.getAllByRole("combobox");
|
|
1825
|
+
expect(comboboxes.length).toBeGreaterThanOrEqual(3);
|
|
1826
|
+
case 2:
|
|
1827
|
+
return _context52.a(2);
|
|
1828
|
+
}
|
|
1829
|
+
}, _callee52);
|
|
1830
|
+
})));
|
|
1831
|
+
case 1:
|
|
1832
|
+
return _context53.a(2);
|
|
1833
|
+
}
|
|
1834
|
+
}, _callee53);
|
|
1835
|
+
}));
|
|
1836
|
+
function play(_x1) {
|
|
1837
|
+
return _play1.apply(this, arguments);
|
|
1838
|
+
}
|
|
1839
|
+
return play;
|
|
1840
|
+
}()
|
|
1841
|
+
};
|