From 91c545201c17ed1bfaf5a428bbf03f544e4eed07 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Sun, 6 Oct 2024 00:13:41 +0800 Subject: feat: add editor action for export hash icon for URL hash, floppy disk icon for export --- src/editor.mjs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/editor.mjs') diff --git a/src/editor.mjs b/src/editor.mjs index 2893f94..27744db 100644 --- a/src/editor.mjs +++ b/src/editor.mjs @@ -67,16 +67,25 @@ const editor = new EasyMDE({ action: () => addMapRandomlyByPreset() }, { - name: 'debug', - title: 'Save content as URL', + name: 'export', + title: 'Export current page', text: '\u{1F4BE}', + action: () => { + } + }, + { + name: 'hash', + title: 'Save content as URL', + // text: '\u{1F4BE}', + text: '#', action: () => { const state = { content: editor.value() } window.location.hash = encodeURIComponent(JSON.stringify(state)) navigator.clipboard.writeText(window.location.href) - window.alert('URL copied to clipboard') + window.alert('URL updated in address bar, you can save current page as bookmark') } }, + '|', { name: 'undo', title: 'Undo last editing', -- cgit v1.2.3-70-g09d2