@modusoperandi/licit-vignette 1.0.1 → 1.1.2

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.
@@ -54,12 +54,13 @@ export const VignetteTableCellNodeSpec = (nodespec) => ({
54
54
  ],
55
55
  toDOM(node) {
56
56
  const base = nodespec.toDOM(node);
57
+ const borderColor = node.attrs.borderColor || '#36598d';
57
58
  if (node.attrs.vignette &&
58
59
  Array.isArray(base) &&
59
60
  1 < base.length &&
60
61
  base[1].style) {
61
62
  base[1].style +=
62
- 'border-radius: 10px; border:none!important; box-shadow: inset 0 0 0 1px #36598d;';
63
+ `border-radius: 10px; border:none!important; box-shadow: inset 0 0 0 1px ${borderColor};`;
63
64
  }
64
65
  base[1].vignette = node.attrs.vignette;
65
66
  return base;
@@ -7,6 +7,6 @@ export declare class VignettePlugin extends Plugin {
7
7
  constructor();
8
8
  getEffectiveSchema(schema: Schema): Schema;
9
9
  initButtonCommands(): {
10
- '[crop] Insert Vignette': VignetteCommand;
10
+ '[vignette] Insert Vignette': VignetteCommand;
11
11
  };
12
12
  }
package/VignettePlugin.js CHANGED
@@ -33,7 +33,7 @@ export class VignettePlugin extends Plugin {
33
33
  }
34
34
  initButtonCommands() {
35
35
  return {
36
- '[crop] Insert Vignette': new VignetteCommand(),
36
+ '[vignette] Insert Vignette': new VignetteCommand(),
37
37
  };
38
38
  }
39
39
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modusoperandi/licit-vignette",
3
- "version": "1.0.1",
3
+ "version": "1.1.2",
4
4
  "type": "module",
5
5
  "subversion": "1",
6
6
  "description": "Vignette plugin built with ProseMirror",
@@ -21,10 +21,14 @@
21
21
  "test": "jest --coverage",
22
22
  "debug": "node --debug-brk --inspect ./node_modules/.bin/jest -i",
23
23
  "ci:bom": "cyclonedx-npm --ignore-npm-errors --short-PURLs --output-format XML --output-file dist/bom.xml",
24
- "ci:build": "tsc --build && copyfiles --up 1 \"src/**/*.css\" dist && copyfiles package.json dist"
24
+ "ci:build": "tsc --build && copyfiles --up 1 \"src/**/*.css\" dist && copyfiles package.json dist",
25
+ "verify": "npm run lint -- --fix && npm run ci:build && npm run test:coverage && echo 'All Tests Passed!'"
25
26
  },
26
27
  "peerDependencies": {
27
- "@modusoperandi/licit-ui-commands": "^1.0.0"
28
+ "@modusoperandi/licit-ui-commands": "^1.0.8"
29
+ },
30
+ "dependencies": {
31
+ "@modusoperandi/color-picker": "^1.0.4"
28
32
  },
29
33
  "devDependencies": {
30
34
  "@cyclonedx/cyclonedx-npm": "^1.11.0",
@@ -34,7 +38,7 @@
34
38
  "@testing-library/user-event": "^14.4.3",
35
39
  "@types/jest": "^29.2.0",
36
40
  "@types/node": "^22.0.0",
37
- "@types/react": "^18.3.3",
41
+ "@types/react": "^19.0.3",
38
42
  "@typescript-eslint/eslint-plugin": "^8.0.0",
39
43
  "@typescript-eslint/parser": "^8.0.0",
40
44
  "ajv": "^8.12.0",
@@ -0,0 +1 @@
1
+ {"root":["../src/index.ts"],"version":"5.6.2"}
@@ -1,7 +1,7 @@
1
1
  // @flow
2
- import nullthrows from 'nullthrows';
3
2
  import { setCellAttr } from 'prosemirror-tables';
4
- import { ColorEditor, atAnchorRight, createPopUp, } from '@modusoperandi/licit-ui-commands';
3
+ import { atAnchorRight, createPopUp, findNodesWithSameMark, MARK_TEXT_COLOR, RuntimeService, } from '@modusoperandi/licit-ui-commands';
4
+ import { ColorEditor } from '@modusoperandi/color-picker';
5
5
  import { UICommand } from '@modusoperandi/licit-doc-attrs-step';
6
6
  export class TableColorCommand extends UICommand {
7
7
  _popUp = null;
@@ -18,15 +18,27 @@ export class TableColorCommand extends UICommand {
18
18
  if (this._popUp) {
19
19
  return Promise.resolve(undefined);
20
20
  }
21
- const target = nullthrows(event).currentTarget;
21
+ const target = event?.currentTarget;
22
22
  if (!(target instanceof HTMLElement)) {
23
23
  return Promise.resolve(undefined);
24
24
  }
25
+ const { doc, selection, schema } = _state;
26
+ const { from, to } = selection;
27
+ const markType = schema.marks[MARK_TEXT_COLOR];
28
+ const result = findNodesWithSameMark(doc, from, to, markType);
29
+ const hex = result?.mark.attrs.color ?? null;
25
30
  const anchor = event?.currentTarget;
31
+ const node = _state.tr.doc.nodeAt(from);
32
+ const Textmark = node?.marks.find((mark) => mark?.attrs?.color);
33
+ const Textcolor = Textmark?.attrs?.color;
34
+ // [FS] KNITE-1489 2024-12-25
35
+ // Fix:VIgnette Color and Border Palette GUIs should match GUIs of Font and Background tools in Doc Edit View
26
36
  return new Promise((resolve) => {
27
- this._popUp = createPopUp(ColorEditor, null, {
37
+ this._popUp = createPopUp(ColorEditor, { hex, runtime: RuntimeService.Runtime, Textcolor }, {
28
38
  anchor,
29
39
  position: atAnchorRight,
40
+ popUpId: 'mo-menuList-child',
41
+ autoDismiss: true,
30
42
  onClose: (val) => {
31
43
  if (this._popUp) {
32
44
  this._popUp = null;