Skip to content

Commit

Permalink
GN-4825: Correctly shows "Insert snippet" button (#672)
Browse files Browse the repository at this point in the history
  • Loading branch information
dkozickis authored Jun 11, 2024
1 parent e10a117 commit eaa66f6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/giant-camels-glow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'frontend-gelinkt-notuleren': patch
---

GN-4825: Show "Insert snippet" when required
13 changes: 11 additions & 2 deletions app/components/rdfa-editor-container.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ import AttributeEditor from '@lblod/ember-rdfa-editor/components/_private/attrib
import RdfaEditor from '@lblod/ember-rdfa-editor/components/_private/rdfa-editor';
import DebugInfo from '@lblod/ember-rdfa-editor/components/_private/debug-info';

/**
* `shouldShowRdfa` - boolean that indicates whether the editor should be in "RDFA aware" mode, or in old RDFA display mode.
* `true` - RDFA aware mode, `false | undefined` - old RDFA display mode
* `shouldEditRdfa` - boolean that indicates whether the "RDFA aware" debug tools will be available
*/
export default class RdfaEditorContainerComponent extends Component {
@service features;
@tracked controller;
Expand Down Expand Up @@ -48,7 +53,8 @@ export default class RdfaEditorContainerComponent extends Component {
firefoxCursorFix(),
lastKeyPressedPlugin,
chromeHacksPlugin(),
this.args.shouldEditRdfa && editableNodePlugin(),
(this.args.shouldEditRdfa || this.args.shouldShowRdfa) &&
editableNodePlugin(),
)
.filter((nullCheck) => nullCheck);
}
Expand Down Expand Up @@ -89,7 +95,10 @@ export default class RdfaEditorContainerComponent extends Component {
}

get activeNode() {
if (this.controller && this.args.shouldEditRdfa) {
if (
this.controller &&
(this.args.shouldEditRdfa || this.args.shouldShowRdfa)
) {
return getActiveEditableNode(this.controller.activeEditorState);
}
return null;
Expand Down

0 comments on commit eaa66f6

Please sign in to comment.