@atlaskit/adf-schema 42.0.0 → 42.0.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/adf-schema
2
2
 
3
+ ## 42.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 0e37f47: Fix type definition for inline node
8
+
9
+ ## 42.0.1
10
+
11
+ ### Patch Changes
12
+
13
+ - 0f5e112: Support "#top" and "#" special hrefs for link mark
14
+
3
15
  ## 42.0.0
4
16
 
5
17
  ### Major Changes
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.toJSON = exports.link = void 0;
7
+ exports.toJSON = exports.link = exports.getLinkAttrs = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _markTypes = require("../../next-schema/generated/markTypes");
10
10
  var _url = require("../../utils/url");
@@ -14,7 +14,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
14
14
  * @name link_mark
15
15
  */
16
16
 
17
- var getLinkAttrs = function getLinkAttrs(attribute) {
17
+ var getLinkAttrs = exports.getLinkAttrs = function getLinkAttrs(attribute) {
18
18
  return function (domNode) {
19
19
  var dom = domNode;
20
20
  var href = dom.getAttribute(attribute) || '';
@@ -119,5 +119,7 @@ function normalizeUrl(url) {
119
119
  * checks if root relative link
120
120
  */
121
121
  function isRootRelative(url) {
122
- return url.startsWith('/');
122
+ // Support `#top` and `#` special references as per:
123
+ // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#linking_to_an_element_on_the_same_page
124
+ return url.startsWith('/') || url === '#top' || url === '#';
123
125
  }
@@ -5,7 +5,7 @@ import { isRootRelative, isSafeUrl, normalizeUrl } from '../../utils/url';
5
5
  * @name link_mark
6
6
  */
7
7
 
8
- const getLinkAttrs = attribute => domNode => {
8
+ export const getLinkAttrs = attribute => domNode => {
9
9
  const dom = domNode;
10
10
  const href = dom.getAttribute(attribute) || '';
11
11
  const attrs = {
@@ -105,5 +105,7 @@ export function normalizeUrl(url) {
105
105
  * checks if root relative link
106
106
  */
107
107
  export function isRootRelative(url) {
108
- return url.startsWith('/');
108
+ // Support `#top` and `#` special references as per:
109
+ // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#linking_to_an_element_on_the_same_page
110
+ return url.startsWith('/') || url === '#top' || url === '#';
109
111
  }
@@ -8,7 +8,7 @@ import { isRootRelative, isSafeUrl, normalizeUrl } from '../../utils/url';
8
8
  * @name link_mark
9
9
  */
10
10
 
11
- var getLinkAttrs = function getLinkAttrs(attribute) {
11
+ export var getLinkAttrs = function getLinkAttrs(attribute) {
12
12
  return function (domNode) {
13
13
  var dom = domNode;
14
14
  var href = dom.getAttribute(attribute) || '';
@@ -107,5 +107,7 @@ export function normalizeUrl(url) {
107
107
  * checks if root relative link
108
108
  */
109
109
  export function isRootRelative(url) {
110
- return url.startsWith('/');
110
+ // Support `#top` and `#` special references as per:
111
+ // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#linking_to_an_element_on_the_same_page
112
+ return url.startsWith('/') || url === '#top' || url === '#';
111
113
  }
@@ -28,6 +28,10 @@ export interface LinkDefinition {
28
28
  type: 'link';
29
29
  attrs: LinkAttributes;
30
30
  }
31
+ export declare const getLinkAttrs: (attribute: string) => (domNode: Node | string) => false | {
32
+ __confluenceMetadata: string;
33
+ href?: string;
34
+ };
31
35
  export declare const link: MarkSpec;
32
36
  export declare const toJSON: (mark: Mark) => {
33
37
  type: string;
@@ -1,3 +1,12 @@
1
+ import { DateDefinition as Date } from '../date';
2
+ import { EmojiDefinition as Emoji } from '../emoji';
3
+ import { HardBreakDefinition as HardBreak } from '../hard-break';
4
+ import { InlineCardDefinition as InlineCard } from '../inline-card';
5
+ import { InlineExtensionDefinition } from '../inline-extension';
6
+ import { MediaInlineDefinition } from '../media-inline';
7
+ import { MentionDefinition as Mention } from '../mention';
8
+ import { PlaceholderDefinition as Placeholder } from '../placeholder';
9
+ import { StatusDefinition as Status } from '../status';
1
10
  import { TextDefinition as Text } from '../text';
2
11
  import { MarksObject } from './mark';
3
12
  import { AnnotationMarkDefinition as Annotation, CodeDefinition as Code, EmDefinition as Em, LinkDefinition as Link, StrikeDefinition as Strike, StrongDefinition as Strong, SubSupDefinition as SubSup, TextColorDefinition as TextColor, UnderlineDefinition as Underline, BackgroundColorDefinition as BackgroundColor } from '../../marks';
@@ -16,4 +25,4 @@ export type InlineCode = Text & MarksObject<Code | Link | Annotation>;
16
25
  /**
17
26
  * @name inline_node
18
27
  */
19
- export type Inline = InlineFormattedText | InlineCode;
28
+ export type Inline = InlineFormattedText | InlineCode | HardBreak | Mention | Emoji | InlineExtensionDefinition | Date | Placeholder | InlineCard | Status | MediaInlineDefinition;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-schema",
3
- "version": "42.0.0",
3
+ "version": "42.0.2",
4
4
  "description": "Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"