@seafile/comment-editor 0.0.1-alpha.25 → 0.0.1-alpha.27

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.
@@ -11,12 +11,12 @@ var _sdocServerApi = _interopRequireDefault(require("./api/sdoc-server-api"));
11
11
  var _seafileApi = _interopRequireDefault(require("./api/seafile-api"));
12
12
  class Context {
13
13
  constructor() {
14
- (0, _defineProperty2.default)(this, "initSettings", () => {
15
- this.settings = window.seafile ? window.seafile : window.seafileConfig;
14
+ (0, _defineProperty2.default)(this, "initSettings", settings => {
15
+ this.settings = settings ? settings : window.seafile ? window.seafile : window.seafileConfig;
16
16
  const {
17
- name,
18
- username,
19
- avatarURL
17
+ name = '',
18
+ username = '',
19
+ avatarURL = ''
20
20
  } = this.settings;
21
21
  const userInfo = {
22
22
  name,
@@ -24,13 +24,6 @@ class Context {
24
24
  avatar_url: avatarURL
25
25
  };
26
26
  this.user = userInfo;
27
- if (this.settings['isSdocRevision']) {
28
- const repoID = this.getSetting('repoID');
29
- const siteRoot = this.getSetting('siteRoot');
30
- const originFilePath = this.getSetting('originFilePath');
31
- const originFileURL = `${siteRoot}lib/${repoID}/file${originFilePath}`;
32
- this.settings['originFileURL'] = originFileURL;
33
- }
34
27
  });
35
28
  (0, _defineProperty2.default)(this, "uploadLocalImage", imageFiles => {
36
29
  const docUuid = this.getSetting('docUuid');
@@ -55,8 +48,8 @@ class Context {
55
48
  this.api = null;
56
49
  this.config = null;
57
50
  }
58
- init(api) {
59
- this.initSettings(); // lazy init context class
51
+ init(settings, api) {
52
+ this.initSettings(settings); // lazy init context class
60
53
  this.api = api;
61
54
  // const server = this.getSetting('serviceUrl');
62
55
  // const token = this.getSetting('accessToken');
@@ -272,7 +272,7 @@ const CommentEditor = _ref => {
272
272
  onSubmit: onSubmit,
273
273
  submitBtnText: t(submitTip),
274
274
  onCancel: onCancel
275
- }))), /*#__PURE__*/_react.default.createElement(_insertElementDialog.default, {
275
+ }))), !hiddenToolMenu && /*#__PURE__*/_react.default.createElement(_insertElementDialog.default, {
276
276
  editor: editor
277
277
  }));
278
278
  };
@@ -28,7 +28,10 @@ const CommentEditorToolbar = _ref => {
28
28
  (0, _useSelectionUpdate.default)();
29
29
  const eventBus = _eventBus.default.getInstance();
30
30
  return /*#__PURE__*/_react.default.createElement("div", {
31
- className: "comment-editor-toolbar"
31
+ className: "comment-editor-toolbar",
32
+ style: !hiddenToolMenu ? {
33
+ 'justifyContent': 'end'
34
+ } : {}
32
35
  }, !hiddenToolMenu && /*#__PURE__*/_react.default.createElement(_commons.MenuGroup, {
33
36
  className: "menu-group comment-editor-menu-group"
34
37
  }, /*#__PURE__*/_react.default.createElement(_comemntEditorMenu.default, {
@@ -29,10 +29,11 @@ const SeafileCommentEditor = _ref => {
29
29
  hiddenToolMenu,
30
30
  closePanel,
31
31
  addParticipants,
32
- // api
32
+ // settings
33
+ settings,
33
34
  api
34
35
  } = _ref;
35
- _basicSdk.context.init(api);
36
+ _basicSdk.context.init(settings, api);
36
37
  return /*#__PURE__*/_react.default.createElement(_errorBoundary.default, null, /*#__PURE__*/_react.default.createElement(_basicSdk.CommentProvider, {
37
38
  type: type,
38
39
  userInfo: userInfo,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/comment-editor",
3
- "version": "0.0.1-alpha.25",
3
+ "version": "0.0.1-alpha.27",
4
4
  "private": false,
5
5
  "description": "This is a comment editor",
6
6
  "main": "dist/index.js",