@bigfootai/bigfoot-types 3.1.2 → 3.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.
- package/editor.js +42 -0
- package/editor.ts +39 -0
- package/model.js +1 -0
- package/model.ts +2 -0
- package/package.json +5 -1
package/editor.js
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.bigfootSchema = void 0;
|
7
|
+
const prosemirror_model_1 = require("prosemirror-model");
|
8
|
+
const prosemirror_schema_basic_1 = require("prosemirror-schema-basic");
|
9
|
+
const prosemirror_schema_list_1 = require("prosemirror-schema-list");
|
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
|
+
recommendationId: { default: null },
|
17
|
+
},
|
18
|
+
inclusive: false,
|
19
|
+
parseDOM: [
|
20
|
+
{
|
21
|
+
tag: 'span[data-tag-id]',
|
22
|
+
getAttrs(dom) {
|
23
|
+
return {
|
24
|
+
tagId: dom.getAttribute('data-tag-id'),
|
25
|
+
recommendationId: dom.getAttribute('data-recommendation-id'),
|
26
|
+
};
|
27
|
+
},
|
28
|
+
},
|
29
|
+
],
|
30
|
+
toDOM(node) {
|
31
|
+
const { tagId, recommendationId } = node.attrs;
|
32
|
+
return [
|
33
|
+
'span',
|
34
|
+
{
|
35
|
+
'data-tag-id': tagId,
|
36
|
+
'data-recommendation-id': recommendationId,
|
37
|
+
},
|
38
|
+
0,
|
39
|
+
];
|
40
|
+
},
|
41
|
+
}),
|
42
|
+
});
|
package/editor.ts
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
import { Schema } from 'prosemirror-model';
|
2
|
+
import { schema } from 'prosemirror-schema-basic';
|
3
|
+
import { addListNodes } from 'prosemirror-schema-list';
|
4
|
+
import orderedMap from 'orderedmap';
|
5
|
+
|
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
|
+
recommendationId: { default: null },
|
12
|
+
},
|
13
|
+
inclusive: false,
|
14
|
+
parseDOM: [
|
15
|
+
{
|
16
|
+
tag: 'span[data-tag-id]',
|
17
|
+
getAttrs(dom) {
|
18
|
+
return {
|
19
|
+
tagId: (dom as HTMLElement).getAttribute('data-tag-id'),
|
20
|
+
recommendationId: (dom as HTMLElement).getAttribute(
|
21
|
+
'data-recommendation-id'
|
22
|
+
),
|
23
|
+
};
|
24
|
+
},
|
25
|
+
},
|
26
|
+
],
|
27
|
+
toDOM(node) {
|
28
|
+
const { tagId, recommendationId } = node.attrs;
|
29
|
+
return [
|
30
|
+
'span',
|
31
|
+
{
|
32
|
+
'data-tag-id': tagId,
|
33
|
+
'data-recommendation-id': recommendationId,
|
34
|
+
},
|
35
|
+
0,
|
36
|
+
];
|
37
|
+
},
|
38
|
+
}),
|
39
|
+
});
|
package/model.js
CHANGED
package/model.ts
CHANGED
@@ -654,6 +654,7 @@ type Article {${PrimitiveFields}
|
|
654
654
|
dates: [EntityEntry]
|
655
655
|
locations: [EntityEntry]
|
656
656
|
linkUrls: [String]
|
657
|
+
emails: [String]
|
657
658
|
sharingTags: [SharingTag]
|
658
659
|
recommendations: [TagRecommendation]
|
659
660
|
relations: [RelationEntry]
|
@@ -666,6 +667,7 @@ export class Article extends Primitive {
|
|
666
667
|
dates?: EntityEntry[];
|
667
668
|
locations?: EntityEntry[];
|
668
669
|
linkUrls?: string[];
|
670
|
+
emails?: string[];
|
669
671
|
sharingTags?: SharingTag[];
|
670
672
|
recommendations?: TagRecommendation[];
|
671
673
|
relations?: RelationEntry[];
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"author": "Bigfoot",
|
3
3
|
"name": "@bigfootai/bigfoot-types",
|
4
|
-
"version": "3.
|
4
|
+
"version": "3.2.0",
|
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,10 @@
|
|
14
14
|
"dev": "node model.js"
|
15
15
|
},
|
16
16
|
"dependencies": {
|
17
|
+
"orderedmap": "^2.1.1",
|
18
|
+
"prosemirror-model": "^1.19.4",
|
19
|
+
"prosemirror-schema-basic": "^1.2.2",
|
20
|
+
"prosemirror-schema-list": "^1.3.0",
|
17
21
|
"uuid": "^9.0.1"
|
18
22
|
},
|
19
23
|
"devDependencies": {
|