Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

fix(selection-handler): handle more cases without lastRange #59

Merged
merged 1 commit into from
Sep 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion addon/components/besluit-context-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,12 @@ export default class BesluitContextCardComponent extends Component {
@action
selectionChangedHandler() {
this.articleElement = undefined;
const selectedRange = this.args.controller.lastRange;
if (!selectedRange) {
return;
}
const limitedDatastore = this.args.controller.datastore.limitToRange(
this.args.controller.selection.lastRange,
selectedRange,
'rangeIsInside'
);
const besluit = limitedDatastore
Expand Down
8 changes: 6 additions & 2 deletions addon/components/besluit-plugin-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
import { getTitleForDecision } from '../utils/get-title-for-decision';

export default class EditorPluginsTemplateVariableCardComponent extends Component {
export default class BesluitPluginCardComponent extends Component {
@tracked hasTitle = true;
@tracked disableArticleInsert = true;

Expand All @@ -27,8 +27,12 @@ export default class EditorPluginsTemplateVariableCardComponent extends Componen

@action
selectionChangedHandler() {
const selectedRange = this.args.controller.selection.lastRange;
if (!selectedRange) {
return;
}
const limitedDatastore = this.args.controller.datastore.limitToRange(
this.args.controller.selection.lastRange,
selectedRange,
'rangeIsInside'
);
const besluit = limitedDatastore
Expand Down