Use different initial content for development/release

#build
This commit is contained in:
Jonatan Heyman 2023-01-15 20:24:31 +01:00
parent 895bd4eccc
commit 996d4338ce
3 changed files with 17 additions and 5 deletions

View File

@ -63,7 +63,7 @@ async function createWindow() {
//nativeTheme.themeSource = "light" //nativeTheme.themeSource = "light"
if (process.env.VITE_DEV_SERVER_URL) { // electron-vite-vue#298 if (process.env.VITE_DEV_SERVER_URL) { // electron-vite-vue#298
win.loadURL(url) win.loadURL(url + '?dev=1')
// Open devTool if the app is not packaged // Open devTool if the app is not packaged
//win.webContents.openDevTools() //win.webContents.openDevTools()
} else { } else {

View File

@ -2,7 +2,7 @@
import HelloWorld from './components/HelloWorld.vue' import HelloWorld from './components/HelloWorld.vue'
import StatusBar from './components/StatusBar.vue' import StatusBar from './components/StatusBar.vue'
import Editor from './components/Editor.vue' import Editor from './components/Editor.vue'
export default { export default {
components: { components: {
@ -20,6 +20,7 @@
theme: window.darkMode.initial, theme: window.darkMode.initial,
initialTheme: window.darkMode.initial, initialTheme: window.darkMode.initial,
systemTheme: 'system', systemTheme: 'system',
development: window.location.href.indexOf("dev=1") !== -1,
} }
}, },
@ -66,6 +67,7 @@
<Editor <Editor
@cursorChange="onCursorChange" @cursorChange="onCursorChange"
:theme="theme" :theme="theme"
:development="development"
class="editor" class="editor"
/> />
<StatusBar <StatusBar

View File

@ -1,11 +1,22 @@
<script> <script>
import { ref, shallowRef } from 'vue' import { ref, shallowRef } from 'vue'
import { HeynoteEditor } from '../editor/editor.js' import { HeynoteEditor } from '../editor/editor.js'
import initialData from "../editor/fixture.js" import testContent from "../editor/fixture.js"
const initialContent = `
text-a
Welcome to Heynote!
[ + Enter] Insert new note block
[ + A] Select all text in a note block. Press again to select the whole scratchpad
[ + + Up/Down]  Add additional cursor above/below
text-a
`
export default { export default {
props: [ props: [
"theme", "theme",
"development",
], ],
mounted() { mounted() {
this.$refs.editor.addEventListener("selectionChange", (e) => { this.$refs.editor.addEventListener("selectionChange", (e) => {
@ -19,8 +30,7 @@
this.editor = new HeynoteEditor({ this.editor = new HeynoteEditor({
element: this.$refs.editor, element: this.$refs.editor,
//content: "\ntext\n", content: this.development ? testContent : initialContent,
content: initialData,
theme: this.theme, theme: this.theme,
}) })
}, },