@atlaskit/editor-common 114.1.1 → 114.2.0

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.
Files changed (48) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/cjs/card/ui/assets/card.js +13 -7
  3. package/dist/cjs/card/ui/assets/embed.js +13 -7
  4. package/dist/cjs/card/ui/assets/inline.js +13 -7
  5. package/dist/cjs/card/ui/assets/url.js +13 -7
  6. package/dist/cjs/extensibility/ExtensionNodeWrapper.js +1 -1
  7. package/dist/cjs/extensibility/extensionNodeView.js +1 -1
  8. package/dist/cjs/monitoring/error.js +1 -1
  9. package/dist/cjs/resizer/BreakoutResizer.js +7 -4
  10. package/dist/cjs/resizer/Resizer.js +33 -12
  11. package/dist/cjs/table/content-mode.js +62 -0
  12. package/dist/cjs/table/index.js +19 -0
  13. package/dist/cjs/toolbar/context.js +14 -4
  14. package/dist/cjs/ui/DropList/index.js +1 -1
  15. package/dist/cjs/ui/MediaSingle/styled.js +1 -1
  16. package/dist/es2019/card/ui/assets/card.js +14 -7
  17. package/dist/es2019/card/ui/assets/embed.js +14 -7
  18. package/dist/es2019/card/ui/assets/inline.js +14 -7
  19. package/dist/es2019/card/ui/assets/url.js +14 -7
  20. package/dist/es2019/extensibility/ExtensionNodeWrapper.js +1 -1
  21. package/dist/es2019/extensibility/extensionNodeView.js +1 -1
  22. package/dist/es2019/monitoring/error.js +1 -1
  23. package/dist/es2019/resizer/BreakoutResizer.js +7 -4
  24. package/dist/es2019/resizer/Resizer.js +33 -13
  25. package/dist/es2019/table/content-mode.js +56 -0
  26. package/dist/es2019/table/index.js +2 -1
  27. package/dist/es2019/toolbar/context.js +17 -9
  28. package/dist/es2019/ui/DropList/index.js +1 -1
  29. package/dist/es2019/ui/MediaSingle/styled.js +1 -1
  30. package/dist/esm/card/ui/assets/card.js +14 -7
  31. package/dist/esm/card/ui/assets/embed.js +14 -7
  32. package/dist/esm/card/ui/assets/inline.js +14 -7
  33. package/dist/esm/card/ui/assets/url.js +14 -7
  34. package/dist/esm/extensibility/ExtensionNodeWrapper.js +1 -1
  35. package/dist/esm/extensibility/extensionNodeView.js +1 -1
  36. package/dist/esm/monitoring/error.js +1 -1
  37. package/dist/esm/resizer/BreakoutResizer.js +7 -4
  38. package/dist/esm/resizer/Resizer.js +33 -12
  39. package/dist/esm/table/content-mode.js +57 -0
  40. package/dist/esm/table/index.js +2 -1
  41. package/dist/esm/toolbar/context.js +15 -5
  42. package/dist/esm/ui/DropList/index.js +1 -1
  43. package/dist/esm/ui/MediaSingle/styled.js +1 -1
  44. package/dist/types/table/content-mode.d.ts +35 -0
  45. package/dist/types/table/index.d.ts +1 -0
  46. package/dist/types-ts4.5/table/content-mode.d.ts +35 -0
  47. package/dist/types-ts4.5/table/index.d.ts +1 -0
  48. package/package.json +1 -4
@@ -250,7 +250,7 @@ var RenderFallbackContainer = function RenderFallbackContainer(_ref2) {
250
250
 
251
251
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- Needs manual remediation
252
252
  export var mediaWrapperStyle = function mediaWrapperStyle(props) {
253
- return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n\tposition: relative;\n\n\t", "\n\n\t/* Editor */\n & > figure {\n\t\tposition: ", ";\n\t\theight: 100%;\n\t\twidth: 100%;\n\t}\n\n\t/* Comments on media project adds comment badge as child of the media wrapper,\n\tthus we need to exclude it so that style is applied to intended div */\n\t& > div:not([data-media-badges='true']) {\n\t\tposition: ", ";\n\t\theight: 100%;\n\t\twidth: 100%;\n\t}\n\n\t& * [data-mark-annotation-type='inlineComment'] {\n\t\twidth: 100%;\n\t\theight: 100%;\n\t}\n\n\t&[data-node-type='embedCard'] > div {\n\t\twidth: 100%;\n\t}\n\n\t/* Renderer */\n\t[data-node-type='media'] {\n\t\tposition: static !important;\n\t\t", "\n\n\t\t> div {\n\t\t\tposition: absolute;\n\t\t\theight: 100%;\n\t\t}\n\t}\n"])), RenderFallbackContainer(props), props.hasFallbackContainer ? 'absolute' : 'relative', props.hasFallbackContainer ? 'absolute' : 'relative', fg('platform_forge_ui_support_images_in_adfrenderer') ? 'height: auto !important;' : '');
253
+ return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n\tposition: relative;\n\n\t", "\n\n\t/* Editor */\n & > figure {\n\t\tposition: ", ";\n\t\theight: 100%;\n\t\twidth: 100%;\n\t}\n\n\t/* Comments on media project adds comment badge as child of the media wrapper,\n\tthus we need to exclude it so that style is applied to intended div */\n\t& > div:not([data-media-badges='true']) {\n\t\tposition: ", ";\n\t\theight: 100%;\n\t\twidth: 100%;\n\t}\n\n\t& * [data-mark-annotation-type='inlineComment'] {\n\t\twidth: 100%;\n\t\theight: 100%;\n\t}\n\n\t&[data-node-type='embedCard'] > div {\n\t\twidth: 100%;\n\t}\n\n\t/* Renderer */\n\t[data-node-type='media'] {\n\t\tposition: static !important;\n\t\theight: auto !important;\n\n\t\t> div {\n\t\t\tposition: absolute;\n\t\t\theight: 100%;\n\t\t}\n\t}\n"])), RenderFallbackContainer(props), props.hasFallbackContainer ? 'absolute' : 'relative', props.hasFallbackContainer ? 'absolute' : 'relative');
254
254
  };
255
255
  var MediaWrapper = function MediaWrapper(_ref3) {
256
256
  var children = _ref3.children,
@@ -0,0 +1,35 @@
1
+ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
+ /**
3
+ * Returns true if any cell in the first row of the table has a colwidth attribute set.
4
+ *
5
+ * Used by both the editor (as `hasTableColumnBeenResized`) and the renderer (as `hasColWidths`)
6
+ * to determine whether a table has had its columns manually resized.
7
+ */
8
+ export declare const hasTableColumnBeenResized: (tableNode: PMNode) => boolean;
9
+ /**
10
+ * Returns true if the table has been explicitly resized — either the table itself has a width
11
+ * attribute set, or any column has been individually resized (colwidth present on cells).
12
+ */
13
+ export declare const hasTableBeenResized: (tableNode: PMNode) => boolean;
14
+ /**
15
+ * Determines whether a table should render in content mode.
16
+ *
17
+ * Content mode tables have no fixed column widths — the browser sizes columns to fit their
18
+ * content (`table-layout: auto`). This is the shared core predicate used by both the editor
19
+ * and the renderer. Each consumer is responsible for computing `isSupported` from its own
20
+ * feature flags / props before calling this function.
21
+ *
22
+ * A table is in content mode when ALL of the following are true:
23
+ * 1. The `platform_editor_table_fit_to_content_auto_convert` experiment is enabled
24
+ * 2. `isSupported` is true (caller has verified resizing is allowed and appearance is full-page)
25
+ * 3. The table is not nested inside another table or block node
26
+ * 4. The table node exists
27
+ * 5. The table has not been explicitly resized (`width === null` and no `colwidth` on cells)
28
+ * 6. The table's layout is `'align-start'`
29
+ */
30
+ export declare const isTableInContentMode: ({ tableNode, isSupported, isTableNested, }: {
31
+ /** Whether the current environment supports content mode (resizing enabled, full-page appearance). */
32
+ isSupported: boolean;
33
+ isTableNested?: boolean;
34
+ tableNode: PMNode | undefined;
35
+ }) => boolean;
@@ -1,2 +1,3 @@
1
1
  export { SORTABLE_COLUMN_ICON_CLASSNAME } from './consts';
2
2
  export { default as SortingIcon, StatusClassNames } from './SortingIcon';
3
+ export { hasTableBeenResized, hasTableColumnBeenResized, isTableInContentMode, } from './content-mode';
@@ -0,0 +1,35 @@
1
+ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
+ /**
3
+ * Returns true if any cell in the first row of the table has a colwidth attribute set.
4
+ *
5
+ * Used by both the editor (as `hasTableColumnBeenResized`) and the renderer (as `hasColWidths`)
6
+ * to determine whether a table has had its columns manually resized.
7
+ */
8
+ export declare const hasTableColumnBeenResized: (tableNode: PMNode) => boolean;
9
+ /**
10
+ * Returns true if the table has been explicitly resized — either the table itself has a width
11
+ * attribute set, or any column has been individually resized (colwidth present on cells).
12
+ */
13
+ export declare const hasTableBeenResized: (tableNode: PMNode) => boolean;
14
+ /**
15
+ * Determines whether a table should render in content mode.
16
+ *
17
+ * Content mode tables have no fixed column widths — the browser sizes columns to fit their
18
+ * content (`table-layout: auto`). This is the shared core predicate used by both the editor
19
+ * and the renderer. Each consumer is responsible for computing `isSupported` from its own
20
+ * feature flags / props before calling this function.
21
+ *
22
+ * A table is in content mode when ALL of the following are true:
23
+ * 1. The `platform_editor_table_fit_to_content_auto_convert` experiment is enabled
24
+ * 2. `isSupported` is true (caller has verified resizing is allowed and appearance is full-page)
25
+ * 3. The table is not nested inside another table or block node
26
+ * 4. The table node exists
27
+ * 5. The table has not been explicitly resized (`width === null` and no `colwidth` on cells)
28
+ * 6. The table's layout is `'align-start'`
29
+ */
30
+ export declare const isTableInContentMode: ({ tableNode, isSupported, isTableNested, }: {
31
+ /** Whether the current environment supports content mode (resizing enabled, full-page appearance). */
32
+ isSupported: boolean;
33
+ isTableNested?: boolean;
34
+ tableNode: PMNode | undefined;
35
+ }) => boolean;
@@ -1,2 +1,3 @@
1
1
  export { SORTABLE_COLUMN_ICON_CLASSNAME } from './consts';
2
2
  export { default as SortingIcon, StatusClassNames } from './SortingIcon';
3
+ export { hasTableBeenResized, hasTableColumnBeenResized, isTableInContentMode, } from './content-mode';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "114.1.1",
3
+ "version": "114.2.0",
4
4
  "description": "A package that contains common classes and components for editor and renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -251,9 +251,6 @@
251
251
  "platform_editor_ally_remove_role_tabpanel": {
252
252
  "type": "boolean"
253
253
  },
254
- "platform_forge_ui_support_images_in_adfrenderer": {
255
- "type": "boolean"
256
- },
257
254
  "platform_editor_toolbar_aifc_placement_overridden": {
258
255
  "type": "boolean"
259
256
  },