@modusoperandi/licit 1.0.12 → 1.1.1

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/client/Licit.js CHANGED
@@ -215,9 +215,11 @@ var Licit = /*#__PURE__*/function (_React$Component) {
215
215
  /**
216
216
  * Method to open page layout
217
217
  */
218
- _defineProperty(_this, "pageLayout", function (state) {
218
+ _defineProperty(_this, "pageLayout", function () {
219
219
  var DOC_LAYOUT = new DocLayoutCommand();
220
- DOC_LAYOUT.waitForUserInput(state);
220
+ DOC_LAYOUT.waitForUserInput(_this._editorView.state, _this._editorView.dispatch, _this._editorView).then(function (inputs) {
221
+ DOC_LAYOUT.executeWithUserInput(_this._editorView.state, _this._editorView.dispatch, _this._editorView, inputs);
222
+ });
221
223
  });
222
224
  _this.initialize(_props);
223
225
  return _this;
@@ -610,9 +610,20 @@ class Licit extends React.Component<any, any> {
610
610
  /**
611
611
  * Method to open page layout
612
612
  */
613
- pageLayout = (state: EditorState): void => {
613
+ pageLayout = (): void => {
614
614
  const DOC_LAYOUT = new DocLayoutCommand();
615
- DOC_LAYOUT.waitForUserInput(state);
615
+ DOC_LAYOUT.waitForUserInput(
616
+ this._editorView.state,
617
+ this._editorView.dispatch,
618
+ this._editorView
619
+ ).then((inputs) => {
620
+ DOC_LAYOUT.executeWithUserInput(
621
+ this._editorView.state,
622
+ this._editorView.dispatch,
623
+ this._editorView,
624
+ inputs
625
+ );
626
+ });
616
627
  };
617
628
  }
618
629
 
package/index.d.ts CHANGED
@@ -92,7 +92,7 @@ export class Licit extends React.Component<any, any> {
92
92
 
93
93
  goToEnd(): void;
94
94
 
95
- pageLayout(state: EditorState): void;
95
+ pageLayout(): void;
96
96
  }
97
97
 
98
98
  // from './Types';
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@modusoperandi/licit",
3
- "version": "1.0.12",
3
+ "version": "1.1.1",
4
+ "license": "MIT",
4
5
  "type": "module",
5
6
  "subversion": "1",
6
7
  "description": "Rich text editor built with React and ProseMirror",
@@ -24,7 +25,7 @@
24
25
  "build:dist": "npm run build:clean && npm run build:babel && npm run build:flow && npm run build:css && npm run build:fonts && npm run build:bom && cp src/*.d.ts dist/",
25
26
  "build:licit": "node utils/build_bin.js",
26
27
  "ci:bom": "cyclonedx-npm --ignore-npm-errors --short-PURLs --output-format XML --output-file dist/bom.xml",
27
- "ci:build": "npm run build:clean && npm run build:babel && npm run build:flow && npm run build:css && npm run build:fonts && npm run build:bom && copyfiles --up 1 \"src/**/*.d.ts\" dist/ && copyfiles --up 1 \"src/**/*.css\" dist && copyfiles package.json dist",
28
+ "ci:build": "npm run build:clean && npm run build:babel && npm run build:flow && npm run build:css && npm run build:fonts && npm run build:bom && copyfiles --up 1 \"src/**/*.d.ts\" dist/ && copyfiles --up 1 \"src/**/*.css\" dist && copyfiles package.json LICENSE dist",
28
29
  "flow": "flow --show-all-errors",
29
30
  "lint:css": "stylelint \"**/*.css\"",
30
31
  "lint:js": "eslint \"src/**/*.js\"",
@@ -68,14 +69,14 @@
68
69
  "cors": "^2.8.5",
69
70
  "css-loader": "^7.1.1",
70
71
  "eslint": "^8.0.0",
71
- "eslint-config-prettier": "^9.0.0",
72
+ "eslint-config-prettier": "^10.0.1",
72
73
  "eslint-plugin-jest": "^28.2.0",
73
74
  "eslint-plugin-prettier": "^5.1.3",
74
75
  "eslint-plugin-react": "^7.33.2",
75
76
  "exports-loader": "^5.0.0",
76
77
  "express": "^4.17.1",
77
78
  "file-loader": "^6.2.0",
78
- "flow-bin": "^0.258.1",
79
+ "flow-bin": "^0.259.1",
79
80
  "flow-copy-source": "^2.0.9",
80
81
  "flow-typed": "^4.0.0",
81
82
  "flow-webpack-plugin": "^1.2.0",
@@ -1,8 +1,8 @@
1
1
  var _excluded = ["title", "className", "checked", "label", "inline", "name", "onSelect", "disabled"];
2
2
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
3
3
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
4
- function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
5
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
4
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
5
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
6
6
  function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
7
7
  function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
8
8
  function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
@@ -1,4 +1,6 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
2
4
  function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
3
5
  function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
4
6
  function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
@@ -63,14 +65,15 @@ var LinkURLEditor = /*#__PURE__*/function (_React$PureComponent) {
63
65
  if (!(TocNode !== null && TocNode !== void 0 && (_TocNode$attrs = TocNode.attrs) !== null && _TocNode$attrs !== void 0 && _TocNode$attrs.innerLink)) {
64
66
  var nodeUUID = uuid();
65
67
  var texthash = '#';
66
- var nodeAttrs = TocNode.attrs;
68
+ var nodeAttrs = _objectSpread({}, TocNode.attrs);
67
69
  var nodeconcat_UUID = texthash.concat(nodeUUID);
68
70
  nodeAttrs.innerLink = nodeconcat_UUID;
69
- tr.setNodeMarkup(tocNodePosition_, undefined, nodeAttrs);
71
+ tr = tr.setNodeMarkup(tocNodePosition_, undefined, nodeAttrs);
70
72
  textContent = nodeconcat_UUID.concat(INNER_LINK, textContent_);
71
73
  } else {
72
74
  textContent = TocNode.attrs.innerLink.concat(INNER_LINK, textContent_);
73
75
  }
76
+ view.dispatch(tr);
74
77
  _this.props.close(textContent);
75
78
  });
76
79
  _defineProperty(_this, "_onKeyDown", function (e) {
@@ -64,8 +64,7 @@ class LinkURLEditor extends React.PureComponent<any, any> {
64
64
  };
65
65
 
66
66
  render(): React.Element<any> {
67
- const { url, TOCselectedNode_, view_, selectionId } =
68
- this.state;
67
+ const { url, TOCselectedNode_, view_, selectionId } = this.state;
69
68
 
70
69
  const isTOCValid = () => {
71
70
  if (!TOCselectedNode_ || TOCselectedNode_.length === 0) {
@@ -73,7 +72,7 @@ class LinkURLEditor extends React.PureComponent<any, any> {
73
72
  }
74
73
 
75
74
  return TOCselectedNode_.some(
76
- item => item.node_ && item.node_.textContent.trim() !== ''
75
+ (item) => item.node_ && item.node_.textContent.trim() !== ''
77
76
  );
78
77
  };
79
78
  const isValid = isTOCValid();
@@ -92,7 +91,7 @@ class LinkURLEditor extends React.PureComponent<any, any> {
92
91
 
93
92
  return (
94
93
  <div className="czi-image-url-editor">
95
- <div className="czi-form" style={{padding:'10px', display:'flex'}}>
94
+ <div className="czi-form" style={{ padding: '10px', display: 'flex' }}>
96
95
  <div className="tab">
97
96
  <button
98
97
  className="tablinks"
@@ -138,7 +137,7 @@ class LinkURLEditor extends React.PureComponent<any, any> {
138
137
  </form>
139
138
  </div>
140
139
  {!isValid ? (
141
- <div className="tabcontent" id="innerlink" >
140
+ <div className="tabcontent" id="innerlink">
142
141
  <p>No TOC styles</p>
143
142
  <div className="czi-form-buttons">
144
143
  <CustomButton label="Cancel" onClick={this._cancel} />
@@ -151,13 +150,19 @@ class LinkURLEditor extends React.PureComponent<any, any> {
151
150
  <br></br>
152
151
  <select
153
152
  defaultValue={
154
- TOCselectedNode_.some(res => res.node_.textContent === url) ? url : null
153
+ TOCselectedNode_.some(
154
+ (res) => res.node_.textContent === url
155
+ )
156
+ ? url
157
+ : null
155
158
  }
156
159
  id="toc"
157
160
  name="toccontents"
158
161
  size="3"
159
162
  >
160
- {TOCselectedNode_?.filter(res => res.node_.textContent.trim() !== '').map((res, index) => (
163
+ {TOCselectedNode_?.filter(
164
+ (res) => res.node_.textContent.trim() !== ''
165
+ ).map((res, index) => (
161
166
  <option
162
167
  data-tooltip-content={res.node_.textContent}
163
168
  data-tooltip-id="select-toc-tooltip"
@@ -193,20 +198,21 @@ class LinkURLEditor extends React.PureComponent<any, any> {
193
198
  }
194
199
 
195
200
  handleOptionChange = (textContent_, tocNodePosition_, view: EditorView) => {
196
- const tr = view.state.tr;
201
+ let tr = view.state.tr;
197
202
  const TocNode = view.state.doc.nodeAt(tocNodePosition_);
198
203
  let textContent;
199
204
  if (!TocNode?.attrs?.innerLink) {
200
205
  const nodeUUID = uuid();
201
206
  const texthash = '#';
202
- const nodeAttrs = TocNode.attrs;
207
+ const nodeAttrs = { ...TocNode.attrs };
203
208
  const nodeconcat_UUID = texthash.concat(nodeUUID);
204
209
  nodeAttrs.innerLink = nodeconcat_UUID;
205
- tr.setNodeMarkup(tocNodePosition_, undefined, nodeAttrs);
210
+ tr = tr.setNodeMarkup(tocNodePosition_, undefined, nodeAttrs);
206
211
  textContent = nodeconcat_UUID.concat(INNER_LINK, textContent_);
207
212
  } else {
208
213
  textContent = TocNode.attrs.innerLink.concat(INNER_LINK, textContent_);
209
214
  }
215
+ view.dispatch(tr);
210
216
  this.props.close(textContent);
211
217
  };
212
218