@modusoperandi/licit 0.14.3 → 0.14.14

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.
@@ -13,6 +13,7 @@ var _TableCellMenu = _interopRequireDefault(require("./ui/TableCellMenu"));
13
13
  var _bindScrollHandler = _interopRequireDefault(require("./ui/bindScrollHandler"));
14
14
  var _isElementFullyVisible = _interopRequireDefault(require("./ui/isElementFullyVisible"));
15
15
  require("@modusoperandi/licit-ui-commands/dist/ui/czi-pop-up.css");
16
+ var _prosemirrorTables = require("prosemirror-tables");
16
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
18
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
18
19
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -71,9 +72,15 @@ class TableCellTooltipView {
71
72
  }
72
73
  let cellEl = domFound.node;
73
74
  const popUp = this._popUp;
75
+ let actionNode = null;
76
+ if (result && state.selection instanceof _prosemirrorTables.CellSelection) {
77
+ actionNode = state.selection.$anchorCell.node(-1);
78
+ }
74
79
  const viewPops = {
75
80
  editorState: state,
76
- editorView: view
81
+ editorView: view,
82
+ pluginView: this,
83
+ actionNode
77
84
  };
78
85
  if (cellEl && !(0, _isElementFullyVisible.default)(cellEl)) {
79
86
  cellEl = null;
@@ -13,6 +13,7 @@ import { createPopUp } from '@modusoperandi/licit-ui-commands';
13
13
  import isElementFullyVisible from './ui/isElementFullyVisible';
14
14
 
15
15
  import '@modusoperandi/licit-ui-commands/dist/ui/czi-pop-up.css';
16
+ import { CellSelection } from 'prosemirror-tables';
16
17
 
17
18
  class TableCellTooltipView {
18
19
  _cellElement: null;
@@ -41,9 +42,15 @@ class TableCellTooltipView {
41
42
 
42
43
  let cellEl = domFound.node;
43
44
  const popUp = this._popUp;
45
+ let actionNode = null;
46
+ if (result && state.selection instanceof CellSelection) {
47
+ actionNode = state.selection.$anchorCell.node(-1);
48
+ }
44
49
  const viewPops = {
45
50
  editorState: state,
46
51
  editorView: view,
52
+ pluginView: this,
53
+ actionNode,
47
54
  };
48
55
 
49
56
  if (cellEl && !isElementFullyVisible(cellEl)) {
@@ -482,7 +482,9 @@ class TableResizePlugin extends _prosemirrorState.Plugin {
482
482
  key: PLUGIN_KEY,
483
483
  state: {
484
484
  init(_, state) {
485
- this.spec.props.nodeViews[(0, _prosemirrorTables.tableNodeTypes)(state.schema).table.name] = createTableView;
485
+ if (!this.spec.props.nodeViews['table']) {
486
+ this.spec.props.nodeViews[(0, _prosemirrorTables.tableNodeTypes)(state.schema).table.name] = createTableView;
487
+ }
486
488
  return new ResizeState(-1, null);
487
489
  },
488
490
  apply(tr, prev) {
@@ -595,9 +595,10 @@ export default class TableResizePlugin extends Plugin {
595
595
  key: PLUGIN_KEY,
596
596
  state: {
597
597
  init(_: any, state: EditorState): ResizeState {
598
- this.spec.props.nodeViews[
599
- tableNodeTypes(state.schema).table.name
600
- ] = createTableView;
598
+ if (!this.spec.props.nodeViews['table']) {
599
+ this.spec.props.nodeViews[tableNodeTypes(state.schema).table.name] =
600
+ createTableView;
601
+ }
601
602
  return new ResizeState(-1, null);
602
603
  },
603
604
  apply(tr: Transform, prev: EditorState): EditorState {