Skip to content

Commit c30f0ee

Browse files
committed
backwards compatible
1 parent f0ba825 commit c30f0ee

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ npm-debug.log
1212
.#*
1313

1414
/todo
15+
.DS_Store

src/assets/js/datastore.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,19 @@ export default class DataStore {
161161
return await this._set(this._lineKey_(row), line);
162162
}
163163

164+
// for backwards compatibility - checks whether the line was struck through
165+
// in the old-style format
166+
public async _isStruckThroughOldFormat(row: Row): Promise<boolean> {
167+
const line = await this._get<any>(this._lineKey_(row), []);
168+
if (typeof line !== 'string' && line.length) {
169+
let char_info = line[0];
170+
if (char_info.properties && char_info.properties.strikethrough) {
171+
return true;
172+
}
173+
}
174+
return false;
175+
}
176+
164177
public async getParents(row: Row): Promise<Array<Row>> {
165178
return await this._get(this._parentsKey_(row), [], decodeParents);
166179
}

src/plugins/todo/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ registerPlugin<void>(
3333
});
3434

3535
async function isStruckThrough(session: Session, row: Row) {
36+
// for backwards compatibility
37+
const isStruckThroughOldStyle = await session.document.store._isStruckThroughOldFormat(row);
38+
if (isStruckThroughOldStyle) { return true; }
39+
3640
const text = await session.document.getText(row);
3741
return (text.slice(0, 2) === '~~') && (text.slice(-2) === '~~');
3842
}

0 commit comments

Comments
 (0)