diff --git a/inspector/text.js b/inspector/text.js index 51aaa9e..2d79017 100644 --- a/inspector/text.js +++ b/inspector/text.js @@ -218,6 +218,8 @@ export const emptyTextmap = () => { return textmap } +export const cloneTextmap = (textmap) => [...textmap.map(r => [...r])] + const TextCodes = { DELETE_KEY: 0xfe, CLR_KEY: 0xfd, @@ -396,21 +398,27 @@ export const pageNav = ({ pages, tracker }) => {
${page > 0 ? html` - { + { tracker.group(() => { pages.splice(page - 1, 2, pages[page], pages[page - 1]) editState.page = page - 1 }) }}>${'<'}${' '} - { + { tracker.group(() => { pages.splice(page, 1) editState.page = page - 1 }) }}>X${' '} ` : null} + { + tracker.group(() => { + pages.splice(page, 0, makePage(tracker, cloneTextmap(textmap))) + editState.page = page + 1 + }) + }}>⎘${' '} ${page < (pages.length - 1) ? html` - { + { tracker.group(() => { pages.splice(page, 2, pages[page + 1], pages[page]) editState.page = page + 1 @@ -420,12 +428,12 @@ export const pageNav = ({ pages, tracker }) => {
`)}
- { +
` @@ -456,8 +464,10 @@ export const textEditView = ({ pages, tracker }) => { <${booleanCheckbox} obj=${editState} field="insertMode">Insert mode
<${booleanCheckbox} obj=${editState} field="spaceMouse">Spacebar draws selected char
<${booleanCheckbox} obj=${editState} field="onlyDrawingChars">Hide text characters
+ +
- navigator.clipboard.writeText(JSON.stringify(generateTextJson(editState, pages), null, 2))}> +