mirror of
https://github.com/misode/misode.github.io.git
synced 2026-05-03 06:02:54 +00:00
Add history
This commit is contained in:
+1
-1
@@ -15,7 +15,7 @@
|
|||||||
"@types/split.js": "^1.4.0",
|
"@types/split.js": "^1.4.0",
|
||||||
"copy-webpack-plugin": "^6.0.1",
|
"copy-webpack-plugin": "^6.0.1",
|
||||||
"html-webpack-plugin": "^4.3.0",
|
"html-webpack-plugin": "^4.3.0",
|
||||||
"minecraft-schemas": "^0.2.0",
|
"minecraft-schemas": "^0.2.1",
|
||||||
"split.js": "^1.5.11",
|
"split.js": "^1.5.11",
|
||||||
"ts-loader": "^7.0.4",
|
"ts-loader": "^7.0.4",
|
||||||
"typescript": "^3.9.3",
|
"typescript": "^3.9.3",
|
||||||
|
|||||||
@@ -1,6 +1,13 @@
|
|||||||
import { AbstractView, Path, locale } from "minecraft-schemas";
|
import { AbstractView, Path, locale, DataModel } from "minecraft-schemas";
|
||||||
|
|
||||||
export class ErrorsView extends AbstractView {
|
export class ErrorsView extends AbstractView {
|
||||||
|
target: HTMLElement
|
||||||
|
|
||||||
|
constructor(model: DataModel, target: HTMLElement) {
|
||||||
|
super(model)
|
||||||
|
this.target = target
|
||||||
|
}
|
||||||
|
|
||||||
render(): void {
|
render(): void {
|
||||||
this.target.style.display = this.model.errors.count() > 0 ? 'flex' : 'none'
|
this.target.style.display = this.model.errors.count() > 0 ? 'flex' : 'none'
|
||||||
|
|
||||||
|
|||||||
@@ -95,6 +95,8 @@ Promise.all([
|
|||||||
const treeControlsVersionToggle = document.getElementById('tree-controls-version-toggle')!
|
const treeControlsVersionToggle = document.getElementById('tree-controls-version-toggle')!
|
||||||
const treeControlsVersionMenu = document.getElementById('tree-controls-version-menu')!
|
const treeControlsVersionMenu = document.getElementById('tree-controls-version-menu')!
|
||||||
const treeControlsReset = document.getElementById('tree-controls-reset')!
|
const treeControlsReset = document.getElementById('tree-controls-reset')!
|
||||||
|
const treeControlsUndo = document.getElementById('tree-controls-undo')!
|
||||||
|
const treeControlsRedo = document.getElementById('tree-controls-redo')!
|
||||||
|
|
||||||
let selected = modelFromPath(location.pathname)
|
let selected = modelFromPath(location.pathname)
|
||||||
|
|
||||||
@@ -253,6 +255,22 @@ Promise.all([
|
|||||||
addChecked(treeControlsReset)
|
addChecked(treeControlsReset)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
treeControlsUndo.addEventListener('click', evt => {
|
||||||
|
models[selected].undo()
|
||||||
|
})
|
||||||
|
|
||||||
|
treeControlsRedo.addEventListener('click', evt => {
|
||||||
|
models[selected].redo()
|
||||||
|
})
|
||||||
|
|
||||||
|
document.addEventListener('keyup', evt => {
|
||||||
|
if (evt.ctrlKey && evt.key === 'z') {
|
||||||
|
models[selected].undo()
|
||||||
|
} else if (evt.ctrlKey && evt.key === 'y') {
|
||||||
|
models[selected].redo()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
errorsToggle.addEventListener('click', evt => {
|
errorsToggle.addEventListener('click', evt => {
|
||||||
if (errorsViewEl.classList.contains('hidden')) {
|
if (errorsViewEl.classList.contains('hidden')) {
|
||||||
errorsViewEl.classList.remove('hidden')
|
errorsViewEl.classList.remove('hidden')
|
||||||
|
|||||||
+2
-2
@@ -48,11 +48,11 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="tree-controls-menu btn-group" id="tree-controls-menu">
|
<div class="tree-controls-menu btn-group" id="tree-controls-menu">
|
||||||
<button class="btn">
|
<button class="btn" id="tree-controls-undo">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.78 12.53a.75.75 0 01-1.06 0L2.47 8.28a.75.75 0 010-1.06l4.25-4.25a.75.75 0 011.06 1.06L4.81 7h7.44a.75.75 0 010 1.5H4.81l2.97 2.97a.75.75 0 010 1.06z"></path></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.78 12.53a.75.75 0 01-1.06 0L2.47 8.28a.75.75 0 010-1.06l4.25-4.25a.75.75 0 011.06 1.06L4.81 7h7.44a.75.75 0 010 1.5H4.81l2.97 2.97a.75.75 0 010 1.06z"></path></svg>
|
||||||
<span data-i18n="undo"></span>
|
<span data-i18n="undo"></span>
|
||||||
</button>
|
</button>
|
||||||
<button class="btn">
|
<button class="btn" id="tree-controls-redo">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M8.22 2.97a.75.75 0 011.06 0l4.25 4.25a.75.75 0 010 1.06l-4.25 4.25a.75.75 0 01-1.06-1.06l2.97-2.97H3.75a.75.75 0 010-1.5h7.44L8.22 4.03a.75.75 0 010-1.06z"></path></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M8.22 2.97a.75.75 0 011.06 0l4.25 4.25a.75.75 0 010 1.06l-4.25 4.25a.75.75 0 01-1.06-1.06l2.97-2.97H3.75a.75.75 0 010-1.5h7.44L8.22 4.03a.75.75 0 010-1.06z"></path></svg>
|
||||||
<span data-i18n="redo"></span>
|
<span data-i18n="redo"></span>
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user