Skip to content
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
2 changes: 2 additions & 0 deletions etc/lime-elements.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2413,6 +2413,8 @@ export interface TabPanelComponent {
// @alpha (undocumented)
export interface TextEditor {
insert: (input: TextEditorNode | string) => void;
// (undocumented)
stopTrigger: () => void;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I know this PR is still WIP, I just happened to see it.)

This change should be part of the first commit, not a separate commit 🤗

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll fix that up 🤗

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you okey with the interface @adrianschmidt ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I've got no problem with it 😄

Maybe it ought to be documented? But it's still @alpha, so not a show-stopper I guess 🙂

}

// @alpha (undocumented)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ export class TextEditorCustomTriggersExample {

if (event.key === ESCAPE) {
this.isPickerOpen = false;
this.triggerFunction?.stopTrigger();
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ export const inserterFactory = (view: EditorView): TextEditor => {
transaction.setMeta('stopTrigger', true);
dispatch(transaction);
},
stopTrigger: () => {
const { state, dispatch } = view;

const transaction = state.tr;
transaction.setMeta('stopTrigger', true);

dispatch(transaction);
},
};
};

Expand Down
1 change: 1 addition & 0 deletions src/components/text-editor/text-editor.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export interface TextEditor {
*
*/
insert: (input: TextEditorNode | string) => void;
stopTrigger: () => void;
}

/**
Expand Down
Loading