Note moving
This commit is contained in:
@@ -91,12 +91,14 @@ class Config {
|
||||
);
|
||||
}
|
||||
}
|
||||
const DEFAULT_WINDOW_SIZE = { width: 354, height: 549 };
|
||||
const DEFAULT_MOVE_WINDOW_SIZE = { width: 708, height: 549 };
|
||||
const preloadPath = join(__dirname, "../preload/index.mjs");
|
||||
const rendererPath = join(__dirname, "../renderer/index.html");
|
||||
function createWindow() {
|
||||
const mainWindow = new BrowserWindow({
|
||||
width: 354,
|
||||
height: 549,
|
||||
width: DEFAULT_WINDOW_SIZE.width,
|
||||
height: DEFAULT_WINDOW_SIZE.height,
|
||||
show: false,
|
||||
autoHideMenuBar: true,
|
||||
webPreferences: {
|
||||
@@ -119,8 +121,8 @@ function createWindow() {
|
||||
}
|
||||
function createNoteWindow(noteId) {
|
||||
const noteWindow = new BrowserWindow({
|
||||
width: 354,
|
||||
height: 549,
|
||||
width: DEFAULT_WINDOW_SIZE.width,
|
||||
height: DEFAULT_WINDOW_SIZE.height,
|
||||
autoHideMenuBar: true,
|
||||
webPreferences: {
|
||||
preload: preloadPath,
|
||||
@@ -186,6 +188,26 @@ app.whenReady().then(async () => {
|
||||
ipcMain.on("note-changed", (_, event, data) => {
|
||||
broadcastNoteChange(event, data);
|
||||
});
|
||||
ipcMain.handle("move-opened", (_) => {
|
||||
const activeWindow = BrowserWindow.getFocusedWindow();
|
||||
const windowSize = activeWindow.getSize();
|
||||
if (windowSize[0] < DEFAULT_MOVE_WINDOW_SIZE.width) {
|
||||
activeWindow.setSize(
|
||||
DEFAULT_MOVE_WINDOW_SIZE.width,
|
||||
DEFAULT_MOVE_WINDOW_SIZE.height
|
||||
);
|
||||
}
|
||||
});
|
||||
ipcMain.handle("move-closed", (_) => {
|
||||
const activeWindow = BrowserWindow.getFocusedWindow();
|
||||
const windowSize = activeWindow.getSize();
|
||||
if (windowSize[0] === 708) {
|
||||
activeWindow.setSize(
|
||||
DEFAULT_WINDOW_SIZE.width,
|
||||
DEFAULT_WINDOW_SIZE.height
|
||||
);
|
||||
}
|
||||
});
|
||||
electronApp.setAppUserModelId("com.electron");
|
||||
app.on("browser-window-created", (_, window) => {
|
||||
optimizer.watchWindowShortcuts(window);
|
||||
|
||||
@@ -21,6 +21,12 @@ const api = {
|
||||
},
|
||||
notifyNoteChanged: (event, data) => {
|
||||
ipcRenderer.send("note-changed", event, data);
|
||||
},
|
||||
moveOpened: () => {
|
||||
ipcRenderer.invoke("move-opened");
|
||||
},
|
||||
moveClosed: () => {
|
||||
ipcRenderer.invoke("move-closed");
|
||||
}
|
||||
};
|
||||
const adapter = {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -337,7 +337,9 @@ a,
|
||||
button,
|
||||
input,
|
||||
pre,
|
||||
span {
|
||||
span,
|
||||
label,
|
||||
li {
|
||||
font-family: var(--font-mono);
|
||||
font-weight: 400;
|
||||
line-height: 1;
|
||||
@@ -603,7 +605,8 @@ main.directory .notes {
|
||||
font-weight: 700;
|
||||
}
|
||||
.note-editor p em {
|
||||
font-style: italic;
|
||||
/* font-style: italic; */
|
||||
color: var(--grey-100);
|
||||
}
|
||||
.note-editor hr {
|
||||
border: 1px dashed currentColor;
|
||||
@@ -789,6 +792,14 @@ main.category .new-note {
|
||||
display: block;
|
||||
margin-top: 9px;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
main.instructions .content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20px;
|
||||
}
|
||||
main.instructions .content hr {
|
||||
border-bottom: 1px dashed currentColor;
|
||||
}main.search .back {
|
||||
display: block;
|
||||
opacity: 0.25;
|
||||
@@ -823,4 +834,74 @@ main.search .results {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 14px;
|
||||
}.preferences {
|
||||
padding-top: 8px;
|
||||
padding-bottom: 60px;
|
||||
}
|
||||
.preferences .back {
|
||||
opacity: 0.25;
|
||||
display: block;
|
||||
margin-top: 9px;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
.preferences h1 {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.preferences .plugin {
|
||||
display: flex;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.preferences input[type=radio] {
|
||||
display: block;
|
||||
flex-shrink: 0;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
margin-right: 10px;
|
||||
border: 1px solid white;
|
||||
cursor: pointer;
|
||||
}
|
||||
.preferences input[type=radio]:checked {
|
||||
background-color: white;
|
||||
}
|
||||
.preferences .info .description {
|
||||
color: var(--grey-100);
|
||||
margin-top: 6px;
|
||||
}
|
||||
.preferences .config {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
margin-top: 16px;
|
||||
}
|
||||
.preferences .config-field {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
.preferences .config-field input {
|
||||
width: 100%;
|
||||
border: 1px solid var(--grey-100);
|
||||
border-radius: 0.2em;
|
||||
padding: 0.2em 0.5em;
|
||||
}
|
||||
.preferences .error {
|
||||
color: red;
|
||||
margin-top: 16px;
|
||||
}
|
||||
.preferences .save-btn {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
padding: 16px 0;
|
||||
text-align: center;
|
||||
border-top: 1px dashed currentColor;
|
||||
background: var(--theme-bg);
|
||||
}
|
||||
.preferences .save-btn .svg-spinner {
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
}
|
||||
.preferences .save-btn:hover {
|
||||
color: var(--theme-accent);
|
||||
}
|
||||
@@ -8,8 +8,8 @@
|
||||
http-equiv="Content-Security-Policy"
|
||||
content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:"
|
||||
/>
|
||||
<script type="module" crossorigin src="./assets/index-CoqDP7Z2.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="./assets/index-CVyE7-c9.css">
|
||||
<script type="module" crossorigin src="./assets/index-CzxWU9vx.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="./assets/index-NYhAwsHy.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
Reference in New Issue
Block a user