Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes multiple blocks delete issue #30

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
3 changes: 3 additions & 0 deletions src/interface.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import useDirectusToken from './use-directus-token';
import useFileHandler from './use-filehandler';
import useTools from './use-tools';
import getTranslations from './translations';
import { wait } from './wait';

export default defineComponent({
props: {
Expand Down Expand Up @@ -174,6 +175,8 @@ export default defineComponent({
isInternalChange.value = true;

try {
// Fixes deleting multiple blocks bug https://github.com/codex-team/editor.js/issues/1755#issuecomment-929550729
await wait(200);
const result: EditorJS.OutputData = await context.saver.save();

if (!result || result.blocks.length < 1) {
Expand Down
3 changes: 3 additions & 0 deletions src/wait.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export async function wait(ms: number): Promise<void> {
return new Promise((resolve) => setTimeout(resolve, ms));
}