@bigfootai/bigfoot-types 3.5.5 → 3.5.6
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/editor.js +37 -47
- package/editor.ts +40 -54
- package/model.js +1 -0
- package/model.ts +2 -0
- package/package.json +2 -1
package/editor.js
CHANGED
@@ -1,58 +1,48 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
6
|
exports.bigfootSchema = void 0;
|
4
7
|
const prosemirror_model_1 = require("prosemirror-model");
|
5
8
|
const prosemirror_schema_basic_1 = require("prosemirror-schema-basic");
|
6
9
|
const prosemirror_schema_list_1 = require("prosemirror-schema-list");
|
7
|
-
const
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
tag: 'span[data-tag-id][data-recommendation-id][data-tag-type]',
|
17
|
-
getAttrs(dom) {
|
18
|
-
return {
|
19
|
-
tagId: dom.getAttribute('data-tag-id'),
|
20
|
-
tagType: dom.getAttribute('data-tag-type'),
|
21
|
-
recommendationId: dom.getAttribute('data-recommendation-id'),
|
22
|
-
};
|
23
|
-
},
|
10
|
+
const orderedmap_1 = __importDefault(require("orderedmap"));
|
11
|
+
exports.bigfootSchema = new prosemirror_model_1.Schema({
|
12
|
+
nodes: (0, prosemirror_schema_list_1.addListNodes)(prosemirror_schema_basic_1.schema.spec.nodes, 'paragraph block*', 'block'),
|
13
|
+
marks: orderedmap_1.default.from(prosemirror_schema_basic_1.schema.spec.marks).addToEnd('tag', {
|
14
|
+
attrs: {
|
15
|
+
tagId: { default: null },
|
16
|
+
tagType: { default: null },
|
17
|
+
recommendationId: { default: null },
|
18
|
+
ignore: { default: null },
|
24
19
|
},
|
25
|
-
|
26
|
-
|
27
|
-
const { tagId, tagType, recommendationId } = node.attrs;
|
28
|
-
return [
|
29
|
-
'span',
|
20
|
+
inclusive: false,
|
21
|
+
parseDOM: [
|
30
22
|
{
|
31
|
-
'data-tag-id'
|
32
|
-
|
33
|
-
|
23
|
+
tag: 'span[data-tag-id][data-tag-type][data-recommendation-id][data-ignore]',
|
24
|
+
getAttrs(dom) {
|
25
|
+
return {
|
26
|
+
tagId: dom.getAttribute('data-tag-id'),
|
27
|
+
tagType: dom.getAttribute('data-tag-type'),
|
28
|
+
recommendationId: dom.getAttribute('data-recommendation-id'),
|
29
|
+
ignore: dom.getAttribute('data-ignore'),
|
30
|
+
};
|
31
|
+
},
|
34
32
|
},
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
33
|
+
],
|
34
|
+
toDOM(node) {
|
35
|
+
const { tagId, tagType, recommendationId, ignore } = node.attrs;
|
36
|
+
return [
|
37
|
+
'span',
|
38
|
+
{
|
39
|
+
'data-tag-id': tagId,
|
40
|
+
'data-tag-type': tagType,
|
41
|
+
'data-recommendation-id': recommendationId,
|
42
|
+
'data-ignore': ignore,
|
43
|
+
},
|
44
|
+
0,
|
45
|
+
];
|
45
46
|
},
|
46
|
-
|
47
|
-
toDOM: () => ['strong', 0],
|
48
|
-
};
|
49
|
-
exports.bigfootSchema = new prosemirror_model_1.Schema({
|
50
|
-
nodes: (0, prosemirror_schema_list_1.addListNodes)(prosemirror_schema_basic_1.schema.spec.nodes, 'paragraph block*', 'block'),
|
51
|
-
marks: {
|
52
|
-
...prosemirror_schema_basic_1.schema.spec.marks,
|
53
|
-
// @ts-expect-error - I will do a better job typing this later. Your friend in time, past you.
|
54
|
-
tag,
|
55
|
-
// @ts-expect-error - I will do a better job typing this later. Your friend in time, past you.
|
56
|
-
strong,
|
57
|
-
},
|
47
|
+
}),
|
58
48
|
});
|
package/editor.ts
CHANGED
@@ -1,63 +1,49 @@
|
|
1
1
|
import { Schema } from 'prosemirror-model';
|
2
2
|
import { schema } from 'prosemirror-schema-basic';
|
3
3
|
import { addListNodes } from 'prosemirror-schema-list';
|
4
|
+
import orderedMap from 'orderedmap';
|
4
5
|
|
5
|
-
const
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
{
|
14
|
-
tag: 'span[data-tag-id][data-recommendation-id][data-tag-type]',
|
15
|
-
getAttrs(dom: HTMLElement) {
|
16
|
-
return {
|
17
|
-
tagId: (dom as HTMLElement).getAttribute('data-tag-id'),
|
18
|
-
tagType: (dom as HTMLElement).getAttribute('data-tag-type'),
|
19
|
-
recommendationId: (dom as HTMLElement).getAttribute(
|
20
|
-
'data-recommendation-id'
|
21
|
-
),
|
22
|
-
};
|
23
|
-
},
|
6
|
+
export const bigfootSchema = new Schema({
|
7
|
+
nodes: addListNodes(schema.spec.nodes, 'paragraph block*', 'block'),
|
8
|
+
marks: orderedMap.from(schema.spec.marks).addToEnd('tag', {
|
9
|
+
attrs: {
|
10
|
+
tagId: { default: null },
|
11
|
+
tagType: { default: null },
|
12
|
+
recommendationId: { default: null },
|
13
|
+
ignore: { default: null },
|
24
14
|
},
|
25
|
-
|
26
|
-
|
27
|
-
attrs: { tagId: string; tagType: string; recommendationId: string };
|
28
|
-
}) {
|
29
|
-
const { tagId, tagType, recommendationId } = node.attrs;
|
30
|
-
return [
|
31
|
-
'span',
|
15
|
+
inclusive: false,
|
16
|
+
parseDOM: [
|
32
17
|
{
|
33
|
-
'data-tag-id'
|
34
|
-
|
35
|
-
|
18
|
+
tag: 'span[data-tag-id][data-tag-type][data-recommendation-id][data-ignore]',
|
19
|
+
getAttrs(dom) {
|
20
|
+
return {
|
21
|
+
tagId: (dom as HTMLElement).getAttribute('data-tag-id'),
|
22
|
+
tagType: (dom as HTMLElement).getAttribute(
|
23
|
+
'data-tag-type'
|
24
|
+
),
|
25
|
+
recommendationId: (dom as HTMLElement).getAttribute(
|
26
|
+
'data-recommendation-id'
|
27
|
+
),
|
28
|
+
ignore: (dom as HTMLElement).getAttribute(
|
29
|
+
'data-ignore'
|
30
|
+
),
|
31
|
+
};
|
32
|
+
},
|
36
33
|
},
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
34
|
+
],
|
35
|
+
toDOM(node) {
|
36
|
+
const { tagId, tagType, recommendationId, ignore } = node.attrs;
|
37
|
+
return [
|
38
|
+
'span',
|
39
|
+
{
|
40
|
+
'data-tag-id': tagId,
|
41
|
+
'data-tag-type': tagType,
|
42
|
+
'data-recommendation-id': recommendationId,
|
43
|
+
'data-ignore': ignore,
|
44
|
+
},
|
45
|
+
0,
|
46
|
+
];
|
49
47
|
},
|
50
|
-
|
51
|
-
toDOM: () => ['strong', 0],
|
52
|
-
};
|
53
|
-
|
54
|
-
export const bigfootSchema = new Schema({
|
55
|
-
nodes: addListNodes(schema.spec.nodes, 'paragraph block*', 'block'),
|
56
|
-
marks: {
|
57
|
-
...schema.spec.marks,
|
58
|
-
// @ts-expect-error - I will do a better job typing this later. Your friend in time, past you.
|
59
|
-
tag,
|
60
|
-
// @ts-expect-error - I will do a better job typing this later. Your friend in time, past you.
|
61
|
-
strong,
|
62
|
-
},
|
48
|
+
}),
|
63
49
|
});
|
package/model.js
CHANGED
package/model.ts
CHANGED
@@ -573,6 +573,7 @@ export const TagFields = `${PrimitiveFields}
|
|
573
573
|
email: String
|
574
574
|
avatar: String
|
575
575
|
inviteStatus: Int
|
576
|
+
originNoteId: String
|
576
577
|
tenantIdVerified: String`;
|
577
578
|
export const TagQL = `
|
578
579
|
type Tag {${TagFields}
|
@@ -589,6 +590,7 @@ export class Tag extends Primitive {
|
|
589
590
|
email?: string;
|
590
591
|
avatar?: string;
|
591
592
|
inviteStatus?: InviteStatus;
|
593
|
+
originNoteId?: string; // If the tag originated from a note, we store that here
|
592
594
|
tenantIdVerified?: string; // The tenant._id that claimed/verified this tag as being them
|
593
595
|
|
594
596
|
constructor(tenantIdCreated: string, alias: string, tagType: TagType) {
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"author": "Bigfoot",
|
3
3
|
"name": "@bigfootai/bigfoot-types",
|
4
|
-
"version": "3.5.
|
4
|
+
"version": "3.5.6",
|
5
5
|
"description": "The internal library for the types used in the Bigfoot platform",
|
6
6
|
"main": "model.js",
|
7
7
|
"license": "ISC",
|
@@ -14,6 +14,7 @@
|
|
14
14
|
"dev": "node model.js"
|
15
15
|
},
|
16
16
|
"dependencies": {
|
17
|
+
"orderedmap": "^2.1.1",
|
17
18
|
"prosemirror-model": "^1.19.4",
|
18
19
|
"prosemirror-schema-basic": "^1.2.2",
|
19
20
|
"prosemirror-schema-list": "^1.3.0",
|