@lblod/ember-rdfa-editor-lblod-plugins 1.0.0-beta.2 → 1.0.0-beta.3

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
@@ -12,6 +12,11 @@
12
12
 
13
13
 
14
14
 
15
+ ## 1.0.0-beta.3 (2023-01-23)
16
+
17
+ add onclick handler to pencil icon in variable plugin
18
+
19
+
15
20
  ## 1.0.0-beta.2 (2023-01-23)
16
21
 
17
22
  #### :boom: Breaking Change
@@ -1,4 +1,4 @@
1
- <AuPill @icon="pencil" @iconAlignment="right" class="variable">
1
+ <AuPill @icon="pencil" @iconAlignment="right" class="variable" {{on "click" this.onClick}}>
2
2
  <div {{did-insert this.didInsertContentWrapper}} {{did-update this.onNodeUpdate @node}}>
3
3
  </div>
4
4
  </AuPill>
@@ -38,6 +38,7 @@ import {
38
38
  RdfaEditorView,
39
39
  redo,
40
40
  Schema,
41
+ Selection,
41
42
  splitBlock,
42
43
  StepMap,
43
44
  Transaction,
@@ -145,6 +146,17 @@ export default class Variable extends Component<EmberNodeArgs> {
145
146
  this.outerView.dispatch(outerSelectionTr);
146
147
  }
147
148
 
149
+ @action
150
+ onClick() {
151
+ if (this.innerView && !this.innerView.hasFocus()) {
152
+ this.innerView.focus();
153
+ const tr = this.innerView.state.tr;
154
+ const selection = Selection.atEnd(tr.doc);
155
+ tr.setSelection(selection);
156
+ this.innerView.dispatch(tr);
157
+ }
158
+ }
159
+
148
160
  @action
149
161
  didInsertContentWrapper(target: Element) {
150
162
  this.contentWrapper = target;
@@ -10,7 +10,7 @@ interface Args {
10
10
  }
11
11
  export default class AuNativeInput extends Component<Args> {
12
12
  constructor(owner: unknown, args: Args);
13
- get width(): "" | "au-c-input--block";
13
+ get width(): "au-c-input--block" | "";
14
14
  get iconAlignment(): "" | "au-c-input-wrapper--left" | "au-c-input-wrapper--right";
15
15
  get error(): "" | "au-c-input--error";
16
16
  get warning(): "" | "au-c-input--warning";
@@ -33,8 +33,9 @@ export default class Variable extends Component<EmberNodeArgs> {
33
33
  get node(): import("prosemirror-model").Node;
34
34
  get pos(): number;
35
35
  get htmlContent(): import("@ember/template/-private/handlebars").SafeString;
36
- get schema(): Schema<"text" | "hard_break" | "date" | "invisible_rdfa" | "placeholder" | "paragraph" | "doc" | "block_rdfa" | "repaired_block", "em" | "link" | "strong" | "underline" | "inline_rdfa" | "strikethrough">;
36
+ get schema(): Schema<"text" | "hard_break" | "date" | "invisible_rdfa" | "paragraph" | "placeholder" | "doc" | "block_rdfa" | "repaired_block", "em" | "strong" | "link" | "underline" | "inline_rdfa" | "strikethrough">;
37
37
  onFocus(): void;
38
+ onClick(): void;
38
39
  didInsertContentWrapper(target: Element): void;
39
40
  onNodeUpdate(): void;
40
41
  dispatchInner: (tr: Transaction) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lblod/ember-rdfa-editor-lblod-plugins",
3
- "version": "1.0.0-beta.2",
3
+ "version": "1.0.0-beta.3",
4
4
  "description": "Ember addon providing lblod specific plugins for the ember-rdfa-editor",
5
5
  "keywords": [
6
6
  "ember-addon",
@@ -1,32 +0,0 @@
1
- <div class="au-c-dropdown" ...attributes>
2
- <AuPill
3
- @skin={{this.skin}}
4
- @size={{@size}}
5
- @actionIcon={{this.icon}}
6
- @iconAlignment={{this.iconAlignment}}
7
- @hideText={{@hideText}}
8
- aria-haspopup="true"
9
- aria-expanded="{{if this.dropdownOpen 'true' 'false'}}"
10
- @onClickAction={{this.toggleDropdown}}
11
- data-test-dropdown-button
12
- data-au-dropdown-toggle
13
- >
14
- <span class="au-c-dropdown__name" data-test-dropdown-title>
15
- {{@title}}
16
- </span>
17
- </AuPill>
18
- <div
19
- class="au-c-dropdown__menu {{this.alignment}} {{if this.dropdownOpen 'is-visible'}}"
20
- role="menu"
21
- tabindex="-1"
22
- {{focus-trap
23
- isActive=this.dropdownOpen
24
- shouldSelfFocus=true
25
- focusTrapOptions=(hash
26
- clickOutsideDeactivates=this.clickOutsideDeactivates
27
- )
28
- }}
29
- >
30
- {{yield}}
31
- </div>
32
- </div>
@@ -1,65 +0,0 @@
1
- import Component from '@glimmer/component';
2
- import { action } from '@ember/object';
3
- import { tracked } from '@glimmer/tracking';
4
-
5
- type Args = {
6
- alignment: 'left' | 'right';
7
- icon: string;
8
- iconAlignment: 'left' | 'right';
9
- skin?: string;
10
- };
11
- export default class AuDropdownPill extends Component<Args> {
12
- @tracked dropdownOpen = false;
13
-
14
- @action
15
- openDropdown() {
16
- this.dropdownOpen = true;
17
- }
18
-
19
- @action
20
- closeDropdown() {
21
- this.dropdownOpen = false;
22
- }
23
-
24
- @action
25
- toggleDropdown() {
26
- this.dropdownOpen = !this.dropdownOpen;
27
- }
28
-
29
- @action
30
- clickOutsideDeactivates(event: InputEvent) {
31
- const toggleButton = document.querySelector('[data-au-dropdown-toggle]');
32
- const isClosedByToggleButton = toggleButton?.contains(
33
- event.target as HTMLInputElement
34
- );
35
-
36
- if (!isClosedByToggleButton) {
37
- this.closeDropdown();
38
- }
39
-
40
- return true;
41
- }
42
-
43
- // Dropdown alignment
44
- get alignment() {
45
- if (this.args.alignment == 'left') return 'au-c-dropdown__menu--left';
46
- if (this.args.alignment == 'right') return 'au-c-dropdown__menu--right';
47
- return '';
48
- }
49
-
50
- get skin() {
51
- return this.args.skin || 'default';
52
- }
53
-
54
- // Set default button icon
55
- get icon() {
56
- if (this.args.icon) return this.args.icon;
57
- else return 'chevron-down';
58
- }
59
-
60
- // Set default icon alignment
61
- get iconAlignment() {
62
- if (this.args.iconAlignment) return this.args.iconAlignment;
63
- else return 'right';
64
- }
65
- }
@@ -1 +0,0 @@
1
- export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/au-dropdown-pill';
@@ -1,19 +0,0 @@
1
- import Component from '@glimmer/component';
2
- type Args = {
3
- alignment: 'left' | 'right';
4
- icon: string;
5
- iconAlignment: 'left' | 'right';
6
- skin?: string;
7
- };
8
- export default class AuDropdownPill extends Component<Args> {
9
- dropdownOpen: boolean;
10
- openDropdown(): void;
11
- closeDropdown(): void;
12
- toggleDropdown(): void;
13
- clickOutsideDeactivates(event: InputEvent): boolean;
14
- get alignment(): "au-c-dropdown__menu--left" | "au-c-dropdown__menu--right" | "";
15
- get skin(): string;
16
- get icon(): string;
17
- get iconAlignment(): "left" | "right";
18
- }
19
- export {};