codex-team / codex-team/editor.js

[Bug] merge is not called on delete if defaultblock does not match the tool type

Open
#1,441 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
31.9k
Forks
2.2k
Avg merge
1d 1h
Merged PRs (30d)
1

Description

Today I added subtitle support,
this can simply be done extending paragraph tool.
I forked the tool and changed the name to 'Subtitle'
I added support of timeline in addition to text like this

```js
/**
* Get current Tools`s data
* @returns {SubtitleData} Current data
* @private
*/
get data() {
let text = this._element.innerHTML;

this._data.text = text;
this._data.sstart = this._element.dataset.start ? this._element.dataset.start : 0;
this._data.send = this._element.dataset.send ? this._element.dataset.end : 0;

return this._data;
}

/**
* Store data in plugin:
* - at the this._data property
* - at the HTML
*
* @param {SubtitleData} data — data to set
* @private
*/
set data(data) {
this._data = data || {};

this._element.innerHTML = this._data.text || '';
this._element.dataset.start=this._data.sstart;
this._element.dataset.end=this._data.send;
}
```

The problem I encounter is that delete that call merge did not work and does nothing, just going up
until the tool matches defaultBlock subtitle.

I think it is a bug because it should look at type of previous block type

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.