viewof exampleShiftEnter = {
const defaultShiftEnterText = `<h2>Setting Up Key Commands</h2>
<p>This editor follows Observable style <i>"Run on <kbd>Shift</kbd> +
<kbd>Enter</kbd>"</i></p>
<p>Since <kbd>Shift</kbd> + <kbd>Enter</kbd> is kinda hard to accomplish in
mobile environments, there's a button too. However, it seems to mess up the
focussing behavior of Observable a bit at the moment</p>`
const {editor, view} = ace(defaultShiftEnterText, undefined, {mode: "ace/mode/html"});
mutable exampleShiftEnterValue = editor.getValue();
editor.commands.addCommand({
name: 'Observablish',
bindKey: {win: 'Shift-Enter', mac: 'Shift-Enter', linux: 'Shift-Enter'},
exec: (editor) => {
mutable exampleShiftEnterValue = editor.getValue();
},
readOnly: true
});
const refresh = html`<button style="margin:0;padding:0;position:absolute;top:0;right:0;min-width:2em;">▶</button>`
const wrapper = html`<div>${view}${refresh}</div>`
refresh.onclick = () => { mutable exampleShiftEnterValue = editor.getValue() };
return wrapper;
}