@seafile/sdoc-editor 2.0.80-test-0.0.2 → 2.0.80-test-0.0.4

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.
@@ -81,6 +81,7 @@ const CommentEditor = _ref => {
81
81
  }, [content, insertContent, updateContent]);
82
82
  const onSubmit = (0, _react.useCallback)(event => {
83
83
  event && event.stopPropagation();
84
+ console.log(3, editor.children);
84
85
  const mdString = (0, _slateToMd.default)(editor.children);
85
86
  updateValue(mdString);
86
87
  addParticipants(userInfo.username);
@@ -42,7 +42,8 @@ const CommentItemCollapseWrapper = _ref => {
42
42
  (0, _react.useEffect)(() => {
43
43
  const initCommentContent = async () => {
44
44
  const htmlString = await _mdToHtml.default.process(topLevelComment.comment);
45
- setCommentContent(String(htmlString));
45
+ const htmlStringRes = String(htmlString);
46
+ setCommentContent((0, _helper.parseHtmlImages)(htmlStringRes));
46
47
  };
47
48
  initCommentContent();
48
49
  }, [topLevelComment.comment]);
@@ -11,13 +11,12 @@ var _react = _interopRequireWildcard(require("react"));
11
11
  var _reactI18next = require("react-i18next");
12
12
  var _reactstrap = require("reactstrap");
13
13
  var _dayjs = _interopRequireDefault(require("dayjs"));
14
- var _urlJoin = _interopRequireDefault(require("url-join"));
15
14
  var _tooltip = _interopRequireDefault(require("../../components/tooltip"));
16
15
  var _context = _interopRequireDefault(require("../../context"));
17
16
  var _mdToHtml = _interopRequireDefault(require("../../slate-convert/md-to-html"));
17
+ var _helper = require("../helper");
18
18
  var _notificationHooks = require("../hooks/notification-hooks");
19
19
  var _commentEditor = _interopRequireDefault(require("./comment-editor"));
20
- var _helper = require("../helper");
21
20
  const CommentItemContent = _ref => {
22
21
  let {
23
22
  isActive,
@@ -45,21 +44,7 @@ const CommentItemContent = _ref => {
45
44
  }, [comment.comment]);
46
45
  const transferHtml = async mdString => {
47
46
  const htmlString = await _mdToHtml.default.process(mdString);
48
- console.log(3, mdString, htmlString);
49
- console.log(4, String(htmlString));
50
47
  const htmlStringRes = String(htmlString);
51
- // let newHtmlString = htmlStringRes;
52
- // // return urlJoin(serviceUrl, assetsUrl, url);
53
-
54
- // if (htmlStringRes.includes('<img')) {
55
- // const serviceUrl = context.getSetting('serviceUrl');
56
- // const assetsUrl = context.getSetting('assetsUrl');
57
- // const baseUrl = urlJoin(serviceUrl, assetsUrl);
58
- // newHtmlString = htmlStringRes.replace(
59
- // /<img\s+([^>]*?)src="\/(.*?)"/g,
60
- // `<img $1src="${baseUrl}/$2"`
61
- // );
62
- // }
63
48
  setEditorContent((0, _helper.parseHtmlImages)(htmlStringRes));
64
49
  };
65
50
  const onDeleteToggle = (0, _react.useCallback)(event => {
@@ -12,9 +12,9 @@ var _reactstrap = require("reactstrap");
12
12
  var _dayjs = _interopRequireDefault(require("dayjs"));
13
13
  var _context = _interopRequireDefault(require("../../context"));
14
14
  var _mdToHtml = _interopRequireDefault(require("../../slate-convert/md-to-html"));
15
+ var _helper = require("../helper");
15
16
  var _commentDeletePopover = _interopRequireDefault(require("./comment-delete-popover"));
16
17
  var _commentEditor = _interopRequireDefault(require("./comment-editor"));
17
- var _helper = require("../helper");
18
18
  const CommentItemReply = _ref => {
19
19
  let {
20
20
  isActive,
@@ -40,6 +40,7 @@ const CommentItemReply = _ref => {
40
40
  }, []);
41
41
  const transferHtml = async mdString => {
42
42
  const htmlString = await _mdToHtml.default.process(mdString);
43
+ console.log(1, mdString, htmlString);
43
44
  const formatHtml = String(htmlString).replace(/\n */g, '');
44
45
  setEditorContent((0, _helper.parseHtmlImages)(formatHtml));
45
46
  };
@@ -53,7 +53,6 @@ const CommentList = _ref => {
53
53
  const contextCommentRef = (0, _react.useRef)({});
54
54
  const insertComment = (0, _react.useCallback)(async function (elementId, comment) {
55
55
  let isContextComment = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
56
- // console.log(1, comment);
57
56
  const res = await _context.default.insertComment(comment);
58
57
  const {
59
58
  comment: returnComment
@@ -76,10 +75,10 @@ const CommentList = _ref => {
76
75
  setShowEditor(true);
77
76
  }, [dispatch, onSetCommentDetail]);
78
77
  const addNewComment = (0, _react.useCallback)(content => {
78
+ console.log(1, content);
79
79
  const user = _context.default.getUserInfo();
80
80
  const time = (0, _dayjs.default)().format('YYYY-MM-DD HH:mm:ss');
81
81
  const textCommentId = _slugid.default.nice();
82
- // console.log(2, content)
83
82
  const comment = {
84
83
  comment: content,
85
84
  detail: {
@@ -45,6 +45,7 @@ const InsertElementDialog = _ref => {
45
45
  const onFileChanged = (0, _react.useCallback)(event => {
46
46
  const imgInfos = (0, _helpers.generateImageInfos)(event.target.files);
47
47
  (0, _helpers.insertImage)(validEditor, imgInfos, validEditor.selection, insertPosition);
48
+ console.log(8, validEditor.children);
48
49
  if (uploadLocalImageInputRef.current) {
49
50
  uploadLocalImageInputRef.current.value = '';
50
51
  }
@@ -76,9 +76,11 @@ exports.generateImageNode = generateImageNode;
76
76
  const insertImage = function (editor, imgInfos, selection) {
77
77
  let position = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : _constants2.INSERT_POSITION.CURRENT;
78
78
  if (!imgInfos) return;
79
+ console.log(1222);
79
80
  if (position !== _constants2.INSERT_POSITION.AFTER) {
80
81
  if (isInsertImageMenuDisabled(editor)) return;
81
82
  }
83
+ console.log(1, position, editor.editorType);
82
84
  const imageNodes = imgInfos.map(_ref => {
83
85
  let {
84
86
  src,
@@ -140,6 +142,7 @@ const insertImage = function (editor, imgInfos, selection) {
140
142
  _slate.Transforms.insertNodes(editor, imageNodes, {
141
143
  at: validSelection
142
144
  });
145
+ console.log(5, editor.editorType, imageNodes);
143
146
  const imageEndSelection = _slate.Path.next(_slate.Path.next(path));
144
147
  (0, _core.focusEditor)(editor, imageEndSelection);
145
148
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "2.0.80-test-0.0.2",
3
+ "version": "2.0.80-test-0.0.4",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",