mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-09-02 20:21:19 +02:00
137 lines
3.7 KiB
HTML
137 lines
3.7 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<head>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1.0">
|
|
<meta charset="utf-8" />
|
|
<title>Notesnook Editor</title>
|
|
<link rel="stylesheet" href="./fonts.css">
|
|
<link rel="stylesheet" href="./index.css">
|
|
</head>
|
|
|
|
<body>
|
|
<div class="app-main">
|
|
<input id="image-input" accept='image/png, image/gif, image/jpeg, image/bmp, image/x-icon' type="file"
|
|
name="name" style="display: none;" />
|
|
<div class="tag-bar-parent hidden noselect">
|
|
<div style="margin: 0px !important;margin-right:5px !important;" class="newtag">
|
|
<p class="newtagp noselect"></p>
|
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"
|
|
width="24" height="24" viewBox="0 0 24 24">
|
|
<path d="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z" />
|
|
</svg>
|
|
</div>
|
|
<div class="tag-bar"></div>
|
|
</div>
|
|
<div id="titlebar">
|
|
<div id="formBox">
|
|
<input maxlength="150" id="titleInput" placeholder="Note title"></input>
|
|
</div>
|
|
|
|
<div class="info-bar">
|
|
<div style="display:flex;">
|
|
<p id="infoempty" ></p>
|
|
<p id="infowords">0 words</p>
|
|
<p style="display:none" id="infodate"></p>
|
|
<p style="display:none" id="infosaved"></p>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
<textarea hidden id="tiny_textarea"></textarea>
|
|
</div>
|
|
<script>
|
|
let editor = null;
|
|
let isLoading = true;
|
|
let regex = /\n/gm;
|
|
let sessionId = null;
|
|
</script>
|
|
<script src="./compressor.min.js"></script>
|
|
<script src="./listeners.js"></script>
|
|
<script src="./dist/main.js"></script>
|
|
<script src="./constants.js"></script>
|
|
<script src="./init.js"></script>
|
|
<script>
|
|
attachMessageListener()
|
|
</script>
|
|
<script>
|
|
|
|
function pressHandler(tag, action, node) {
|
|
let time = 0;
|
|
let _node = node || document.querySelector(tag);
|
|
|
|
_node.ontouchstart = function (event) {
|
|
event.preventDefault();
|
|
time = Date.now();
|
|
}
|
|
_node.ontouchmove = function (event) {
|
|
event.preventDefault();
|
|
}
|
|
|
|
_node.ontouchend = function (event) {
|
|
event.preventDefault();
|
|
let diff = Date.now() - time;
|
|
if (diff < 300) {
|
|
action();
|
|
};
|
|
}
|
|
|
|
}
|
|
|
|
pressHandler('.newtag', function () {
|
|
reactNativeEventHandler("newtag", "new");
|
|
})
|
|
|
|
function clearNode(selector) {
|
|
let node = document.querySelector(selector);
|
|
if (node) {
|
|
node.innerHTML = "";
|
|
}
|
|
}
|
|
|
|
function renderChildernInNode(data, parent, nodeName, classes) {
|
|
if (data.length === 0) {
|
|
let stag = document.querySelector(".newtagp");
|
|
stag.innerText = "Add a tag "
|
|
if (!stag.parentElement.classList.contains('alttagnew')) {
|
|
stag.parentElement.classList.add("alttagnew");
|
|
}
|
|
} else {
|
|
let stag = document.querySelector(".newtagp");
|
|
stag.innerText = "";
|
|
if (stag.parentElement.classList.contains('alttagnew')) {
|
|
stag.parentElement.classList.remove("alttagnew")
|
|
}
|
|
}
|
|
let parentNode = document.querySelector(parent);
|
|
data.forEach(function (item) {
|
|
let childNode = document.createElement(nodeName);
|
|
let pNode = document.createElement('p');
|
|
pNode.innerText = "#" + item.alias
|
|
childNode.appendChild(pNode);
|
|
childNode.dataset.tag = JSON.stringify(item);
|
|
for (var i = 0; i < classes.length; i++) {
|
|
childNode.classList.add(classes[i]);
|
|
}
|
|
pressHandler(null, function () {
|
|
reactNativeEventHandler("notetag", event.target.dataset.tag);
|
|
}, childNode);
|
|
parentNode.appendChild(childNode);
|
|
})
|
|
}
|
|
function toggleNode(selector = "p", value) {
|
|
let node = document.querySelector(selector);
|
|
if (value === "hide" && !node.classList.contains('hidden')) {
|
|
node.classList.add('hidden');
|
|
return;
|
|
}
|
|
if (value === "show" && node.classList.contains('hidden')) {
|
|
node.classList.remove('hidden');
|
|
}
|
|
}
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html> |