Use replace instead of push on code change
Using `push` pollutes the browser history, adding a new entry on every keystroke in the editor. This commit replaces it with `replace`, ensuring that the editor gets a single history entry, but that the URL is still updated as code changes.
This commit is contained in:
@@ -36,7 +36,7 @@ const handleCodeUpdate = code => {
|
||||
codeErrorStore.set(e);
|
||||
console.log('Error in parsed', e.hash);
|
||||
const str = JSON.stringify({ code: code, mermaid: conf });
|
||||
push('/edit/' + Base64.encodeURI(str))
|
||||
replace('/edit/' + Base64.encodeURI(str))
|
||||
const l = e.hash.line;
|
||||
decArr.push(edit.deltaDecorations([], [
|
||||
{ range: new monaco.Range(e.hash.loc.first_line,e.hash.loc.last_line,e.hash.loc.first_column,e.hash.loc.last_column), options: { inlineClassName: 'myInlineDecoration' }}]
|
||||
|
||||
Reference in New Issue
Block a user