dtable-ui-component 0.1.64 → 0.1.65

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.
@@ -67,9 +67,21 @@ var LongTextFormatter = /*#__PURE__*/function (_React$Component) {
67
67
  var valueType = Object.prototype.toString.call(value);
68
68
 
69
69
  if (valueType === '[object String]') {
70
- var pre = getPreviewContent(value);
71
- console.log(pre);
72
- return pre;
70
+ var _getPreviewContent = getPreviewContent(value),
71
+ previewText = _getPreviewContent.previewText,
72
+ images = _getPreviewContent.images,
73
+ links = _getPreviewContent.links,
74
+ checklist = _getPreviewContent.checklist;
75
+
76
+ var validValue = Object.assign({}, {
77
+ text: value,
78
+ preview: previewText,
79
+ images: images,
80
+ links: links,
81
+ checklist: checklist
82
+ });
83
+ console.log(validValue);
84
+ return validValue;
73
85
  }
74
86
 
75
87
  if (valueType === '[object Object]') {
@@ -2,6 +2,7 @@ import { Node } from 'slate';
2
2
  import { deserialize } from './slate2markdown';
3
3
 
4
4
  var getPreviewContent = function getPreviewContent(value) {
5
+ console.log('longText Source: ', value);
5
6
  var content = deserialize(value);
6
7
  var previewContent = {
7
8
  previewText: '',
@@ -14,6 +15,7 @@ var getPreviewContent = function getPreviewContent(value) {
14
15
  };
15
16
  getPreviewInfo(content, previewContent);
16
17
  getPreviewText(content, previewContent);
18
+ console.log('previewContent: ', previewContent);
17
19
  return previewContent;
18
20
  };
19
21
 
@@ -1,26 +1,15 @@
1
- var unified = require('./unified');
2
-
3
- var markdown = require('remark-parse');
4
-
5
- var slug = require('remark-slug');
6
-
7
- var breaks = require('remark-breaks');
8
-
9
- var remark2rehype = require('remark-rehype');
10
-
11
- var format = require('rehype-format');
12
-
13
- var raw = require('rehype-raw');
14
-
15
- var xtend = require('xtend');
16
-
17
- var toHTML = require('hast-util-to-html');
18
-
19
- var sanitize = require('hast-util-sanitize');
20
-
21
- var gh = require('hast-util-sanitize/lib/github');
22
-
23
- var deepmerge = require('deepmerge').default;
1
+ import gh from 'hast-util-sanitize/lib/github.json';
2
+ import unified from './unified';
3
+ import markdown from 'remark-parse';
4
+ import slug from 'remark-slug';
5
+ import breaks from 'remark-breaks';
6
+ import remark2rehype from 'remark-rehype';
7
+ import format from 'rehype-format';
8
+ import raw from 'rehype-raw';
9
+ import xtend from 'xtend';
10
+ import toHTML from 'hast-util-to-html';
11
+ import sanitize from 'hast-util-sanitize';
12
+ import deepmerge from 'deepmerge';
24
13
 
25
14
  function stringify(config) {
26
15
  var settings = xtend(config, this.data('settings'));
@@ -76,9 +76,21 @@ var LongTextFormatter = /*#__PURE__*/function (_React$Component) {
76
76
  var valueType = Object.prototype.toString.call(value);
77
77
 
78
78
  if (valueType === '[object String]') {
79
- var pre = (0, _normalizeLongTextValue.default)(value);
80
- console.log(pre);
81
- return pre;
79
+ var _getPreviewContent = (0, _normalizeLongTextValue.default)(value),
80
+ previewText = _getPreviewContent.previewText,
81
+ images = _getPreviewContent.images,
82
+ links = _getPreviewContent.links,
83
+ checklist = _getPreviewContent.checklist;
84
+
85
+ var validValue = Object.assign({}, {
86
+ text: value,
87
+ preview: previewText,
88
+ images: images,
89
+ links: links,
90
+ checklist: checklist
91
+ });
92
+ console.log(validValue);
93
+ return validValue;
82
94
  }
83
95
 
84
96
  if (valueType === '[object Object]') {
@@ -8,6 +8,7 @@ var _slate = require("slate");
8
8
  var _slate2markdown = require("./slate2markdown");
9
9
 
10
10
  var getPreviewContent = function getPreviewContent(value) {
11
+ console.log('longText Source: ', value);
11
12
  var content = (0, _slate2markdown.deserialize)(value);
12
13
  var previewContent = {
13
14
  previewText: '',
@@ -20,6 +21,7 @@ var getPreviewContent = function getPreviewContent(value) {
20
21
  };
21
22
  getPreviewInfo(content, previewContent);
22
23
  getPreviewText(content, previewContent);
24
+ console.log('previewContent: ', previewContent);
23
25
  return previewContent;
24
26
  };
25
27
 
@@ -1,35 +1,37 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
3
5
  exports.__esModule = true;
4
6
  exports.processorGetAST = exports.processor = void 0;
5
7
 
6
- var unified = require('./unified');
8
+ var _github = _interopRequireDefault(require("hast-util-sanitize/lib/github.json"));
7
9
 
8
- var markdown = require('remark-parse');
10
+ var _unified = _interopRequireDefault(require("./unified"));
9
11
 
10
- var slug = require('remark-slug');
12
+ var _remarkParse = _interopRequireDefault(require("remark-parse"));
11
13
 
12
- var breaks = require('remark-breaks');
14
+ var _remarkSlug = _interopRequireDefault(require("remark-slug"));
13
15
 
14
- var remark2rehype = require('remark-rehype');
16
+ var _remarkBreaks = _interopRequireDefault(require("remark-breaks"));
15
17
 
16
- var format = require('rehype-format');
18
+ var _remarkRehype = _interopRequireDefault(require("remark-rehype"));
17
19
 
18
- var raw = require('rehype-raw');
20
+ var _rehypeFormat = _interopRequireDefault(require("rehype-format"));
19
21
 
20
- var xtend = require('xtend');
22
+ var _rehypeRaw = _interopRequireDefault(require("rehype-raw"));
21
23
 
22
- var toHTML = require('hast-util-to-html');
24
+ var _xtend = _interopRequireDefault(require("xtend"));
23
25
 
24
- var sanitize = require('hast-util-sanitize');
26
+ var _hastUtilToHtml = _interopRequireDefault(require("hast-util-to-html"));
25
27
 
26
- var gh = require('hast-util-sanitize/lib/github');
28
+ var _hastUtilSanitize = _interopRequireDefault(require("hast-util-sanitize"));
27
29
 
28
- var deepmerge = require('deepmerge').default;
30
+ var _deepmerge = _interopRequireDefault(require("deepmerge"));
29
31
 
30
32
  function stringify(config) {
31
- var settings = xtend(config, this.data('settings'));
32
- var schema = deepmerge(gh, {
33
+ var settings = (0, _xtend.default)(config, this.data('settings'));
34
+ var schema = (0, _deepmerge.default)(_github.default, {
33
35
  'attributes': {
34
36
  'input': ['type'],
35
37
  'li': ['className'],
@@ -42,19 +44,19 @@ function stringify(config) {
42
44
  function compiler(tree) {
43
45
  // use sanity to remove dangerous html, the default is
44
46
  // GitHub style sanitation
45
- var hast = sanitize(tree, schema);
46
- return toHTML(hast, settings);
47
+ var hast = (0, _hastUtilSanitize.default)(tree, schema);
48
+ return (0, _hastUtilToHtml.default)(hast, settings);
47
49
  }
48
50
  } // markdown -> mdast -> html AST -> html
49
51
 
50
52
 
51
- var processor = unified().use(markdown, {
53
+ var processor = (0, _unified.default)().use(_remarkParse.default, {
52
54
  commonmark: true
53
- }).use(breaks).use(slug).use(remark2rehype, {
55
+ }).use(_remarkBreaks.default).use(_remarkSlug.default).use(_remarkRehype.default, {
54
56
  allowDangerousHTML: true
55
- }).use(raw).use(format).use(stringify);
57
+ }).use(_rehypeRaw.default).use(_rehypeFormat.default).use(stringify);
56
58
  exports.processor = processor;
57
- var processorGetAST = unified().use(markdown, {
59
+ var processorGetAST = (0, _unified.default)().use(_remarkParse.default, {
58
60
  commonmark: true
59
- }).use(slug);
61
+ }).use(_remarkSlug.default);
60
62
  exports.processorGetAST = processorGetAST;
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "dtable-ui-component",
3
- "version": "0.1.64",
3
+ "version": "0.1.65",
4
4
  "main": "./es/index.js",
5
5
  "dependencies": {
6
- "@seafile/seafile-calendar": "0.0.15",
7
6
  "@seafile/react-image-lightbox": "0.0.9",
7
+ "@seafile/seafile-calendar": "0.0.15",
8
8
  "antd-mobile": "^2.3.3",
9
9
  "astro-classname": "^2.1.0",
10
10
  "deepmerge": "^2.1.0",
11
11
  "enzyme": "^3.11.0",
12
12
  "enzyme-adapter-react-16": "^1.15.2",
13
13
  "glamor": "^2.20.40",
14
- "hast-util-sanitize": "^1.1.2",
15
14
  "is-hotkey": "^0.1.6",
16
15
  "mdast-util-definitions": "^1.2.2",
16
+ "hast-util-sanitize": "^1.1.2",
17
17
  "moment": "^2.26.0",
18
18
  "react": "^16.13.0",
19
19
  "react-app-polyfill": "^1.0.6",
@@ -21,17 +21,10 @@
21
21
  "react-responsive": "^8.0.3",
22
22
  "react-transition-group": "^4.4.1",
23
23
  "reactstrap": "^8.4.1",
24
- "remark": "^9.0.0",
25
- "remark-breaks": "^1.0.0",
26
- "remark-parse": "^5.0.0",
27
- "remark-rehype": "^3.0.0",
28
- "remark-slug": "^5.0.0",
29
- "rehype-format": "^2.2.0",
30
- "rehype-raw": "^2.0.0",
31
24
  "rehype-stringify": "^3.0.0",
25
+ "remark": "^9.0.0",
32
26
  "slate": "0.44.13",
33
27
  "xtend": "^4.0.1"
34
-
35
28
  },
36
29
  "scripts": {
37
30
  "clean:esm": "rm -rf es && mkdir es",
@@ -96,6 +89,7 @@
96
89
  "babel-loader": "8.0.6",
97
90
  "babel-plugin-named-asset-import": "^0.3.6",
98
91
  "babel-preset-react-app": "^9.1.1",
92
+ "bail": "^1.0.5",
99
93
  "camelcase": "^5.3.1",
100
94
  "case-sensitive-paths-webpack-plugin": "2.3.0",
101
95
  "css-loader": "3.4.2",
@@ -111,6 +105,8 @@
111
105
  "eslint-plugin-react-hooks": "^1.6.1",
112
106
  "file-loader": "4.3.0",
113
107
  "fs-extra": "^8.1.0",
108
+ "hast-util-sanitize": "^1.1.2",
109
+ "hast-util-to-html": "^3.1.0",
114
110
  "html-webpack-plugin": "4.0.0-beta.11",
115
111
  "identity-obj-proxy": "3.0.0",
116
112
  "jest": "24.9.0",
@@ -127,17 +123,26 @@
127
123
  "postcss-safe-parser": "4.0.1",
128
124
  "react-dev-utils": "^10.2.0",
129
125
  "react-element-to-jsx-string": "^14.3.1",
126
+ "rehype-format": "^4.0.0",
127
+ "rehype-raw": "^6.1.0",
128
+ "remark-breaks": "^3.0.2",
129
+ "remark-parse": "^5.0.0",
130
+ "remark-rehype": "^10.0.1",
131
+ "remark-slug": "^7.0.1",
132
+ "remark-stringify": "^5.0.0",
130
133
  "resolve": "1.15.0",
131
134
  "resolve-url-loader": "3.1.1",
132
135
  "sass-loader": "8.0.2",
133
136
  "semver": "6.3.0",
134
137
  "style-loader": "0.23.1",
135
138
  "terser-webpack-plugin": "2.3.4",
139
+ "trough": "^1.0.5",
136
140
  "ts-pnp": "1.1.5",
137
141
  "url-loader": "2.3.0",
138
142
  "webpack": "4.41.5",
139
143
  "webpack-dev-server": "3.10.2",
140
144
  "webpack-manifest-plugin": "2.2.0",
141
- "workbox-webpack-plugin": "4.3.1"
145
+ "workbox-webpack-plugin": "4.3.1",
146
+ "x-is-string": "^0.1.0"
142
147
  }
143
148
  }