@lblod/ember-rdfa-editor-lblod-plugins 15.0.0 → 15.2.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @lblod/ember-rdfa-editor-lblod-plugins
2
2
 
3
+ ## 15.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#362](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/362) [`47f2337`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/47f233767cd5f6169e2d4b8a3c71619d0718c035) Thanks [@piemonkey](https://github.com/piemonkey)! - Add incredibly small plugin for highlighting text as redacted
8
+
9
+ ## 15.1.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#343](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/343) [`e9b428c`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/e9b428cdffca32164ce9f2c03540dd5ad6a9ba19) Thanks [@dkozickis](https://github.com/dkozickis)! - GN-4130: Move styles for `data-editor-highlight`
14
+
15
+ Styles that were applied to elements with the `data-editor-highlight` attribute (used by `citation-plugin`) moved from
16
+ [editor repository](https://github.com/lblod/ember-rdfa-editor/pull/1013) to this repo as part of the `citation-plugin`.
17
+
18
+ - [#351](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/351) [`f6fa933`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/f6fa933569a70c3cc0f7d4348c4c8a121b77cd1f) Thanks [@elpoelma](https://github.com/elpoelma)! - Remove explicit creation of `rdfa-id` attributes
19
+
20
+ ### Patch Changes
21
+
22
+ - [`83cc1ae`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/83cc1ae8b3bba280aa001566e7d77109a2d43170) Thanks [@abeforgit](https://github.com/abeforgit)! - bump peerdep to allow editor v7
23
+
3
24
  ## 15.0.0
4
25
 
5
26
  ### Major Changes
package/README.md CHANGED
@@ -810,6 +810,36 @@ Template comments have a specific style that can be imported in the stylesheet w
810
810
  @import 'template-comments-plugin';
811
811
  ```
812
812
 
813
+ ## confidentiality-plugin
814
+
815
+ A very small plugin which allows for marking parts of text as redacted and including the styles to make this visible.
816
+
817
+ To enable the plugin you need to add the `MarkSpec` to the `Schema`:
818
+
819
+ ``` js
820
+ import { redacted } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/confidentiality-plugin/marks/redacted';
821
+ // ...
822
+ new Schema({
823
+ // ...
824
+ marks: {
825
+ // ...
826
+ redacted,
827
+ },
828
+ });
829
+ ```
830
+
831
+ You can then add the button to the toolbar, passing it the `SayController`:
832
+
833
+ ``` hbs
834
+ <ConfidentialityPlugin::Toolbar @controller={{this.controller}} />
835
+ ```
836
+
837
+ To see the redactions you'll need to add styles that target the `[property='ext:redacted']` selector, which can be done easily in Sass by importing the included stylesheet:
838
+
839
+ ``` scss
840
+ @import 'confidentiality-plugin';
841
+ ```
842
+
813
843
  ## Embroider
814
844
  To use `@lblod/ember-rdfa-editor-lblod-plugins` with Embroider some extra Webpack configuration is needed, which you can import like this:
815
845
 
@@ -0,0 +1,6 @@
1
+ <Toolbar::Mark
2
+ @icon="not-visible"
3
+ @title={{t 'confidentiality-plugin.redact'}}
4
+ @mark="redacted"
5
+ @controller={{@controller}}
6
+ />
@@ -0,0 +1 @@
1
+ <ConfidentialityPlugin::Redact @controller={{@controller}}/>
@@ -32,7 +32,6 @@
32
32
  @standOut={{true}} as |card|
33
33
  >
34
34
  <card.content>
35
- {{! template-lint-disable no-down-event-binding }}
36
35
  <AuNativeInput
37
36
  value={{this.inputNumber}}
38
37
  placeholder={{t 'variable.number.type-number'}}
@@ -1,7 +1,6 @@
1
1
  import { PNode } from '@lblod/ember-rdfa-editor';
2
2
  import { CitationSchema } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin';
3
3
  import { unwrap } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
4
- import { v4 as uuid } from 'uuid';
5
4
 
6
5
  export function citedText(
7
6
  schema: CitationSchema,
@@ -13,7 +12,6 @@ export function citedText(
13
12
  href: uri,
14
13
  property: 'eli:cites',
15
14
  typeof: 'eli:LegalExpression',
16
- __rdfaId: uuid(),
17
15
  },
18
16
  [schema.text(title)],
19
17
  );
@@ -0,0 +1 @@
1
+ export { redacted } from './marks/redacted';
@@ -0,0 +1,24 @@
1
+ import { MarkSpec } from 'prosemirror-model';
2
+ import { EXT } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
3
+ import { hasRDFaAttribute } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
4
+
5
+ export const redacted: MarkSpec = {
6
+ toDOM(_node) {
7
+ return ['span', { property: EXT('redacted').prefixed }, 0];
8
+ },
9
+ parseDOM: [
10
+ {
11
+ tag: 'span',
12
+ getAttrs(value) {
13
+ if (typeof value === 'string') {
14
+ return false;
15
+ }
16
+ return (
17
+ hasRDFaAttribute(value, 'property', EXT('redacted')) && {
18
+ property: value.getAttribute('property'),
19
+ }
20
+ );
21
+ },
22
+ },
23
+ ],
24
+ };
@@ -4,7 +4,6 @@ import {
4
4
  NodeSelection,
5
5
  Transaction,
6
6
  } from '@lblod/ember-rdfa-editor';
7
- import { v4 as uuid } from 'uuid';
8
7
  import { besluitArticleStructure } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/standard-template-plugin/utils/nodes';
9
8
  import IntlService from 'ember-intl/services/intl';
10
9
  import { isNone } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
@@ -24,9 +23,7 @@ export default function insertArticleContainer({
24
23
  const { selection, schema } = state;
25
24
  const nodeToInsert = schema.node(
26
25
  'article_container',
27
- {
28
- __rdfaId: uuid(),
29
- },
26
+ {},
30
27
  besluitArticleStructure.constructor({
31
28
  schema,
32
29
  intl,
@@ -3,7 +3,6 @@ import {
3
3
  NodeSelection,
4
4
  Transaction,
5
5
  } from '@lblod/ember-rdfa-editor';
6
- import { v4 as uuid } from 'uuid';
7
6
  import { isNone } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
8
7
  import { transactionCompliesWithShapes } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/validation/utils/transaction-complies-with-shapes';
9
8
  import { findInsertionPosInAncestorOfType } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/find-insertion-pos-in-ancestor-of-type';
@@ -21,7 +20,7 @@ export default function insertDescription({
21
20
  const { selection, schema } = state;
22
21
  const nodeToInsert = schema.node(
23
22
  'description',
24
- { __rdfaId: uuid() },
23
+ {},
25
24
  schema.node(
26
25
  'paragraph',
27
26
  null,
@@ -4,7 +4,6 @@ import {
4
4
  NodeSelection,
5
5
  Transaction,
6
6
  } from '@lblod/ember-rdfa-editor';
7
- import { v4 as uuid } from 'uuid';
8
7
  import { isNone } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
9
8
  import { transactionCompliesWithShapes } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/validation/utils/transaction-complies-with-shapes';
10
9
  import { findInsertionPosInAncestorOfType } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/find-insertion-pos-in-ancestor-of-type';
@@ -23,7 +22,7 @@ export default function insertMotivation({
23
22
  return function (state: EditorState, dispatch?: (tr: Transaction) => void) {
24
23
  const translationWithDocLang = getTranslationFunction(state);
25
24
  const { selection, schema } = state;
26
- const nodeToInsert = schema.node('motivering', { __rdfaId: uuid() }, [
25
+ const nodeToInsert = schema.node('motivering', {}, [
27
26
  schema.node(
28
27
  'paragraph',
29
28
  null,
@@ -1,4 +1,3 @@
1
- import { v4 as uuid } from 'uuid';
2
1
  import { isNone } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
3
2
  import {
4
3
  EditorState,
@@ -21,7 +20,7 @@ export default function insertTitle({
21
20
  const { selection, schema } = state;
22
21
  const nodeToInsert = schema.node(
23
22
  'besluit_title',
24
- { __rdfaId: uuid() },
23
+ {},
25
24
  schema.node(
26
25
  'paragraph',
27
26
  null,
@@ -1,6 +1,5 @@
1
1
  import { Command } from '@lblod/ember-rdfa-editor';
2
2
  import { findInsertionRange } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/_private/find-insertion-range';
3
- import { v4 as uuid } from 'uuid';
4
3
 
5
4
  interface InsertDocumentTitleArgs {
6
5
  placeholder: string;
@@ -27,7 +26,7 @@ export default function insertDocumentTitle({
27
26
  insertionRange.to,
28
27
  schema.node(
29
28
  'document_title',
30
- { __rdfaId: uuid() },
29
+ {},
31
30
  schema.node(
32
31
  'paragraph',
33
32
  null,
@@ -188,16 +188,14 @@ export const besluitArticleStructure: StructureSpec = {
188
188
  `besluit_article`,
189
189
  {
190
190
  resource: `http://data.lblod.info/articles/${uuid()}`,
191
- __rdfaId: uuid(),
192
191
  },
193
192
  [
194
193
  schema.node('besluit_article_header', {
195
194
  number: numberConverted,
196
- __rdfaId: uuid(),
197
195
  }),
198
196
  schema.node(
199
197
  `besluit_article_content`,
200
- { __rdfaId: uuid() },
198
+ {},
201
199
  content ??
202
200
  schema.node(
203
201
  'paragraph',
@@ -0,0 +1 @@
1
+ export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/confidentiality-plugin/redact';
@@ -0,0 +1 @@
1
+ export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/confidentiality-plugin/toolbar';
@@ -48,3 +48,158 @@
48
48
  .citaten--error-code {
49
49
  font-family: var(--au-font-tertiary);
50
50
  }
51
+
52
+ // Start: Styling the highlight when detecting search term inside the editor
53
+ @mixin hints($before, $after) {
54
+ .rdfa-annotations.show-rdfa-blocks [data-editor-highlight=true] {
55
+ &:before {
56
+ content: "#{$before}";
57
+ }
58
+
59
+ &:not([contenteditable=""]):after {
60
+ content: "#{$after}";
61
+ }
62
+ }
63
+ }
64
+
65
+ .rdfa-annotations {
66
+ &.show-rdfa-blocks {
67
+ [data-editor-highlight=true] {
68
+ position: relative;
69
+ border: 1px solid var(--au-gray-200);
70
+ display: block !important; // Override inline styles
71
+ margin: $au-unit-tiny;
72
+ padding: 0;
73
+
74
+ &:before {
75
+ @include au-font-size(1.2rem, 1.2);
76
+ font-family: var(--au-font);
77
+ font-weight: var(--au-medium);
78
+ letter-spacing: 0.01rem;
79
+ color: var(--au-gray-600);
80
+ text-transform: uppercase;
81
+ pointer-events: none;
82
+ content: attr(property) ' ' attr(typeof) ' ' attr(data-type);
83
+ position: relative;
84
+ right: auto;
85
+ top: 0;
86
+ left: 0;
87
+ display: block;
88
+ width: 100%;
89
+ padding: $au-unit-tiny * 0.5;
90
+ transition: none;
91
+ border-bottom: 1px solid var(--au-gray-200);
92
+ background-color: var(--au-gray-100);
93
+ opacity: 1;
94
+ }
95
+
96
+ &:after {
97
+ @include au-font-size($say-smallest-font-size, 1.2);
98
+ font-family: var(--au-font);
99
+ font-weight: var(--au-regular);
100
+ letter-spacing: 0.01rem;
101
+ color: var(--au-gray-600);
102
+ text-transform: uppercase;
103
+ pointer-events: none;
104
+ position: relative;
105
+ right: auto;
106
+ bottom: 0;
107
+ left: 0;
108
+ display: block;
109
+ width: 100%;
110
+ padding: $au-unit-tiny * 0.5;
111
+ transition: none;
112
+ border-top: 1px solid var(--au-gray-200);
113
+ background-color: var(--au-white);
114
+ opacity: 1;
115
+ margin: 0;
116
+ }
117
+ }
118
+ }
119
+
120
+ [data-editor-highlight=true] {
121
+ &:not([contenteditable=""]) {
122
+ background-color: var(--au-gray-100);
123
+ border-bottom: 0.2rem dotted var(--au-gray-300);
124
+ padding-bottom: 0.2rem;
125
+ transition: background-color var(--au-transition);
126
+
127
+ &::selection {
128
+ background-color: var(--au-gray-300);
129
+ }
130
+
131
+ &:hover {
132
+ background-color: var(--au-gray-200);
133
+ }
134
+ }
135
+ }
136
+ }
137
+
138
+ @include hints("Selecteer de juiste optie", "Actie nodig");
139
+
140
+ [data--language=en], [lang=en] {
141
+ @include hints("Select the correct option", "Action required");
142
+ }
143
+
144
+ .rdfa-annotations-hover:not(.show-rdfa-blocks) {
145
+ [data-editor-highlight="true"] {
146
+ &:not(ol):not(ul):not(li):not(span) {
147
+ position: relative;
148
+
149
+ &:before {
150
+ height: 100%;
151
+ top: 0;
152
+ }
153
+ }
154
+
155
+ &:not([contenteditable='']) {
156
+ &:hover {
157
+ border-bottom-color: tint($au-gray-600, 20);
158
+ }
159
+
160
+ &:before {
161
+ @include au-font-size(1.2rem, 1.2);
162
+ position: absolute;
163
+ transition: opacity $au-easing 0.5s, left $au-easing 0.2s;
164
+ right: calc(100% + #{$au-unit-large});
165
+ opacity: 0;
166
+ display: block;
167
+ margin-top: 0.2rem;
168
+ padding-right: $au-unit + $au-unit-small;
169
+ margin-right: -$au-unit + $au-unit-tiny;
170
+ width: $au-unit-huge * 1.5;
171
+ font-family: var(--au-font);
172
+ font-weight: var(--au-medium);
173
+ letter-spacing: 0.01rem;
174
+ text-transform: uppercase;
175
+ text-overflow: ellipsis;
176
+ white-space: nowrap;
177
+ color: var(--au-gray-600);
178
+ pointer-events: none;
179
+ overflow: hidden;
180
+ min-height: 2rem;
181
+ border-right: 1px dashed var(--au-gray-300);
182
+ border-top: 1px dashed var(--au-gray-300);
183
+ z-index: var(--au-z-index-gamma);
184
+ background: var(--au-white) linear-gradient(
185
+ to right,
186
+ $au-white,
187
+ $au-white calc(100% - #{$au-unit + $au-unit-tiny}),
188
+ transparent calc(100% - #{$au-unit + $au-unit-tiny}),
189
+ transparent 100%
190
+ );
191
+ }
192
+ }
193
+ }
194
+
195
+ @include mq($until: 1280px) {
196
+ [data-editor-highlight='true'] {
197
+ &:before {
198
+ display: none !important;
199
+ }
200
+ }
201
+ }
202
+
203
+ }
204
+
205
+ // End: Styling the highlight when detecting search term inside the editor
@@ -0,0 +1,8 @@
1
+ @import 'ember-appuniversum';
2
+
3
+ .rdfa-annotations {
4
+ [property='ext:redacted'] {
5
+ background-color: var(--au-red-400);
6
+ border: 1px solid var(--au-red-600);
7
+ }
8
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lblod/ember-rdfa-editor-lblod-plugins",
3
- "version": "15.0.0",
3
+ "version": "15.2.0",
4
4
  "description": "Ember addon providing lblod specific plugins for the ember-rdfa-editor",
5
5
  "keywords": [
6
6
  "ember-addon",
@@ -71,7 +71,7 @@
71
71
  "@glimmer/component": "^1.1.2",
72
72
  "@glimmer/tracking": "^1.1.2",
73
73
  "@glint/template": "^1.1.0",
74
- "@lblod/ember-rdfa-editor": "^6.1.0",
74
+ "@lblod/ember-rdfa-editor": "^7.0.1",
75
75
  "@rdfjs/types": "^1.1.0",
76
76
  "@release-it/keep-a-changelog": "^3.1.0",
77
77
  "@tsconfig/ember": "^3.0.0",
@@ -122,14 +122,14 @@
122
122
  "ember-simple-auth": "4.2.2",
123
123
  "ember-source": "~4.12.0",
124
124
  "ember-source-channel-url": "^3.0.0",
125
- "ember-template-lint": "^4.16.1",
125
+ "ember-template-lint": "^5.11.2",
126
126
  "ember-try": "^2.0.0",
127
127
  "eslint": "^8.44.0",
128
128
  "eslint-config-prettier": "^9.0.0",
129
129
  "eslint-plugin-ember": "^11.1.0",
130
130
  "eslint-plugin-node": "^11.1.0",
131
131
  "eslint-plugin-prettier": "^5.0.0",
132
- "eslint-plugin-qunit": "^7.3.1",
132
+ "eslint-plugin-qunit": "^8.0.1",
133
133
  "loader.js": "^4.7.0",
134
134
  "npm-run-all": "^4.1.5",
135
135
  "prettier": "^3.0.0",
@@ -138,14 +138,14 @@
138
138
  "qunit-dom": "^2.0.0",
139
139
  "release-it": "^15.5.0",
140
140
  "sass": "^1.49.7",
141
- "typescript": "~5.0.4",
141
+ "typescript": "~5.2.2",
142
142
  "webpack": "^5.74.0"
143
143
  },
144
144
  "peerDependencies": {
145
145
  "@appuniversum/ember-appuniversum": "^2.4.2",
146
146
  "@ember/string": "3.x",
147
147
  "@glint/template": "^1.1.0",
148
- "@lblod/ember-rdfa-editor": "^6.0.0",
148
+ "@lblod/ember-rdfa-editor": "^6.0.0 || ^7.0.1",
149
149
  "ember-concurrency": "2.x || ^3.1.0",
150
150
  "ember-modifier": "^3.2.7",
151
151
  "ember-power-select": "6.x || 7.x",
@@ -0,0 +1 @@
1
+ export { redacted } from './marks/redacted';
@@ -0,0 +1,2 @@
1
+ import { MarkSpec } from 'prosemirror-model';
2
+ export declare const redacted: MarkSpec;
@@ -377,3 +377,6 @@ editor-plugins:
377
377
  contact: In case of persisting issues, contact <a href="mailto:{email}">{email}</a>.
378
378
  nodeview:
379
379
  placeholder: Insert address
380
+
381
+ confidentiality-plugin:
382
+ redact: Redact
@@ -381,3 +381,6 @@ editor-plugins:
381
381
  contact: Bij blijvende problemen, contacteer <a href="mailto:{email}">{email}</a>.
382
382
  nodeview:
383
383
  placeholder: Voeg adres in
384
+
385
+ confidentiality-plugin:
386
+ redact: Redigeren