started work on file saving
This commit is contained in:
parent
95867768c4
commit
db031bc8a8
5 changed files with 22 additions and 0 deletions
|
|
@ -1,6 +1,8 @@
|
||||||
const { convertFileSrc, invoke } = window.__TAURI__.core;
|
const { convertFileSrc, invoke } = window.__TAURI__.core;
|
||||||
const { readTextFile } = window.__TAURI__.fs;
|
const { readTextFile } = window.__TAURI__.fs;
|
||||||
import { render_markdown } from "./main.js";
|
import { render_markdown } from "./main.js";
|
||||||
|
|
||||||
|
var selected_file = "";
|
||||||
export function handle_file_select(filename) {
|
export function handle_file_select(filename) {
|
||||||
if (filename.endsWith("md")) {
|
if (filename.endsWith("md")) {
|
||||||
readTextFile(convertFileSrc(filename)).then(
|
readTextFile(convertFileSrc(filename)).then(
|
||||||
|
|
@ -8,11 +10,19 @@ export function handle_file_select(filename) {
|
||||||
var tag_id = document.getElementById('markdown_input');
|
var tag_id = document.getElementById('markdown_input');
|
||||||
tag_id.innerHTML = "<pre>".concat("", ret).concat("", "</pre>");
|
tag_id.innerHTML = "<pre>".concat("", ret).concat("", "</pre>");
|
||||||
render_markdown();
|
render_markdown();
|
||||||
|
selected_file = filename;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function save_file() {
|
||||||
|
console.log(selected_file);
|
||||||
|
}
|
||||||
|
document.getElementById("save-file").onclick = function () {
|
||||||
|
|
||||||
|
save_file();
|
||||||
|
}
|
||||||
function dropdown(id) {
|
function dropdown(id) {
|
||||||
var dropdown_element = document.getElementById(id);
|
var dropdown_element = document.getElementById(id);
|
||||||
var dropdown_children = dropdown_element.children;
|
var dropdown_children = dropdown_element.children;
|
||||||
|
|
|
||||||
2
src/images/save.svg
Normal file
2
src/images/save.svg
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||||
|
<svg width="800px" height="800px" viewBox="0 0 24 24" role="img" xmlns="http://www.w3.org/2000/svg" aria-labelledby="saveIconTitle" stroke="#000000" stroke-width="1" stroke-linecap="square" stroke-linejoin="miter" fill="none" color="#000000"> <title id="saveIconTitle">Save</title> <path d="M17.2928932,3.29289322 L21,7 L21,20 C21,20.5522847 20.5522847,21 20,21 L4,21 C3.44771525,21 3,20.5522847 3,20 L3,4 C3,3.44771525 3.44771525,3 4,3 L16.5857864,3 C16.8510029,3 17.1053568,3.10535684 17.2928932,3.29289322 Z"/> <rect width="10" height="8" x="7" y="13"/> <rect width="8" height="5" x="8" y="3"/> </svg>
|
||||||
|
After Width: | Height: | Size: 723 B |
|
|
@ -31,6 +31,9 @@
|
||||||
<button class="topbar_button" id="hide-sidebar">
|
<button class="topbar_button" id="hide-sidebar">
|
||||||
<img class="topbar_icon" src="images/menu_button.svg" />
|
<img class="topbar_icon" src="images/menu_button.svg" />
|
||||||
</button>
|
</button>
|
||||||
|
<button class="topbar_button" id="save-file">
|
||||||
|
<img class="topbar_icon" src="images/save.svg" />
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div id="sidebar">
|
<div id="sidebar">
|
||||||
|
|
|
||||||
1
src/saving.js
Normal file
1
src/saving.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
|
||||||
|
|
@ -115,6 +115,12 @@ li {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.top-bar {
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
|
||||||
.topbar_button {
|
.topbar_button {
|
||||||
height: 2em;
|
height: 2em;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue