updates on editor
Former-commit-id: 2928727a06a94c0ea87ed821a472ae662df803d1 [formerly 098bc4234803078aba013f6312d179158194fffb] [formerly d2bb681fe62ba87a29b9866e291fb975489cd3fc [formerly 3d25185a557dab1fa529499572c0e6d5bf187ca1]] Former-commit-id: 288ccb95466fbd234d278886800e1d27c54fa8dd [formerly 78c473865b085e97cf435cb230e2afa85559aba0] Former-commit-id: c5dc56f4d6198c9c306c01573e1a1af5f1827c3a
This commit is contained in:
@@ -30,27 +30,3 @@
|
||||
|
||||
{{ end }}
|
||||
|
||||
{{ define "value" }}
|
||||
{{- if eq .HTMLType "textarea" }}
|
||||
<textarea class="scroll" name="{{ .Name }}" id="{{.Name }}" data-parent-type="{{ .Parent.Type }}">{{ .Content.Other }}</textarea>
|
||||
{{- else if eq .HTMLType "datetime" }}
|
||||
<input name="{{ .Name }}" id="{{ .Name }}" value="{{ .Content.Other.Format "2006-01-02T15:04" }}" type="datetime-local" data-parent-type="{{ .Parent.Type }}"></input>
|
||||
{{- else }}
|
||||
<input name="{{ .Name }}" id="{{ .Name }}" value="{{ .Content.Other }}" type="{{ .HTMLType }}" data-parent-type="{{ .Parent.Type }}"></input>
|
||||
{{- end }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "fielset" }}
|
||||
<fieldset id="{{ .Name }}" data-type="{{ .Type }}">
|
||||
{{- if not (eq .Title "") }}
|
||||
<h3>{{ .Name }}</h3>
|
||||
{{- end }}
|
||||
<div class="action add">
|
||||
<i class="material-icons" title="Add">add</i>
|
||||
</div>
|
||||
<div class="action delete" data-delete="{{ .Name }}">
|
||||
<i class="material-icons" title="Close">close</i>
|
||||
</div>
|
||||
{{- template "blocks" .Content }}
|
||||
</fieldset>
|
||||
{{ end }}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
{{ define "sidebar-addon" }}
|
||||
<a class="action" href="{{ .BaseURL }}/content/">
|
||||
<i class="material-icons">subject</i>
|
||||
<span>Posts and Pages</span>
|
||||
</a>
|
||||
<a class="action" href="{{ .BaseURL }}/themes/">
|
||||
<i class="material-icons">format_paint</i>
|
||||
<span>Themes</span>
|
||||
</a>
|
||||
<a class="action" href="{{ .BaseURL }}/settings/">
|
||||
<i class="material-icons">settings</i>
|
||||
<span>Settings</span>
|
||||
</a>
|
||||
{{ end }}
|
||||
@@ -1,23 +0,0 @@
|
||||
{{ define "templates" }}
|
||||
<template id="question-template">
|
||||
<form class="prompt">
|
||||
<h3></h3>
|
||||
<p></p>
|
||||
<input autofocus type="text">
|
||||
<div>
|
||||
<button type="submit" autofocus class="ok">OK</button>
|
||||
<button class="cancel" onclick="closePrompt(event);">Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</template>
|
||||
|
||||
<template id="message-template">
|
||||
<div class="prompt">
|
||||
<h3></h3>
|
||||
<p></p>
|
||||
<div>
|
||||
<button type="submit" onclick="closePrompt(event);" class="ok">OK</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
{{ end }}
|
||||
@@ -41,6 +41,11 @@ module.exports = {
|
||||
loader: 'vue-loader',
|
||||
options: vueLoaderConfig
|
||||
},
|
||||
{
|
||||
test: /\.css$/,
|
||||
include: /node_modules/,
|
||||
loader: 'style!css'
|
||||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
loader: 'babel-loader',
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
</style>
|
||||
|
||||
{{- if ne .User.StyleSheet "" -}}
|
||||
<style>{{ CSS .User.StyleSheet }}</style>
|
||||
<style>{{ CSS .User.StyleSheet }}</style>
|
||||
{{- end -}}
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
<i class="material-icons">folder</i>
|
||||
<span>My Files</span>
|
||||
</a>
|
||||
|
||||
<div v-if="user.allowNew">
|
||||
<button @click="$store.commit('showNewDir', true)" aria-label="New directory" title="New directory" class="action">
|
||||
<i class="material-icons">create_new_folder</i>
|
||||
@@ -36,6 +37,14 @@
|
||||
<span>New file</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div v-for="plugin in plugins">
|
||||
<button v-for="action in plugin.sidebar" @click="action.click" :aria-label="action.name" :title="action.name" class="action">
|
||||
<i class="material-icons">{{ action.icon }}</i>
|
||||
<span>{{ action.name }}</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<button class="action" id="logout" tabindex="0" role="button" aria-label="Log out">
|
||||
<i class="material-icons" title="Logout">exit_to_app</i>
|
||||
<span>Logout</span>
|
||||
@@ -134,10 +143,19 @@ export default {
|
||||
'showDownload'
|
||||
])
|
||||
},
|
||||
data: function () {
|
||||
return {
|
||||
plugins: []
|
||||
}
|
||||
},
|
||||
mounted: function () {
|
||||
updateColumnSizes()
|
||||
window.addEventListener('resize', updateColumnSizes)
|
||||
|
||||
if (window.plugins !== undefined || window.plugins !== null) {
|
||||
this.plugins = window.plugins
|
||||
}
|
||||
|
||||
document.title = this.req.data.name
|
||||
window.history.replaceState({
|
||||
url: window.location.pathname,
|
||||
|
||||
@@ -1,16 +1,30 @@
|
||||
<template>
|
||||
<form id="editor">
|
||||
<h2 v-if="editor.type == 'complete'">Metadata</h2>
|
||||
<h2 v-if="req.data.editor.type == 'complete'">Metadata</h2>
|
||||
|
||||
<h2 v-if="editor.type == 'complete'">Body</h2>
|
||||
<h2 v-if="req.data.editor.type == 'complete'">Body</h2>
|
||||
|
||||
<div v-if="req.data.editor.type !== 'frontmatter-only'" class="content">
|
||||
<div id="ace"></div>
|
||||
<textarea id="source" name="content">{{ req.data.content }}</textarea>
|
||||
</div>
|
||||
</form>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from 'vuex'
|
||||
|
||||
export default {
|
||||
name: 'editor',
|
||||
computed: mapState(['req']),
|
||||
data: function () {
|
||||
return window.info.req.data
|
||||
return {
|
||||
codemirror: null,
|
||||
simplemde: null
|
||||
}
|
||||
},
|
||||
mounted: function () {
|
||||
|
||||
},
|
||||
methods: {
|
||||
}
|
||||
|
||||
19
_assets/src/components/Editor/ArrayObject.vue
Normal file
19
_assets/src/components/Editor/ArrayObject.vue
Normal file
@@ -0,0 +1,19 @@
|
||||
<template>
|
||||
<fieldset :id="name" :data-type="type">
|
||||
<h3 v-if="title !== ''">{{ name }}</h3>
|
||||
<div class="action add">
|
||||
<i class="material-icons" title="Add">add</i>
|
||||
</div>
|
||||
<div class="action delete" :data-delete="name">
|
||||
<i class="material-icons" title="Close">close</i>
|
||||
</div>
|
||||
<!-- template blocks w/ content -->
|
||||
</fieldset>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'array-object',
|
||||
props: ['name', 'type', 'title', 'content']
|
||||
}
|
||||
</script>
|
||||
28
_assets/src/components/Editor/Value.vue
Normal file
28
_assets/src/components/Editor/Value.vue
Normal file
@@ -0,0 +1,28 @@
|
||||
<template>
|
||||
<textarea v-if="htmlType === 'textarea'"
|
||||
class="scroll"
|
||||
:name="name"
|
||||
:id="name"
|
||||
:data-parent-type="parentType">
|
||||
{{ content.other }}
|
||||
</textarea>
|
||||
<input v-else-if="htmlType ==='datatime'"
|
||||
:name="name"
|
||||
:id="name"
|
||||
:value="content.other"
|
||||
type="datetime-local"
|
||||
:data-parent-type="parentType"></input>
|
||||
<input v-else
|
||||
:name="name"
|
||||
:id="name"
|
||||
:value="content.other"
|
||||
:type="htmlType"
|
||||
:data-parent-type="parentType"></input>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'value',
|
||||
props: ['htmlType', 'name', 'parentType', 'content']
|
||||
}
|
||||
</script>
|
||||
@@ -26,7 +26,12 @@ export default {
|
||||
event.preventDefault()
|
||||
if (this.new === '') return
|
||||
|
||||
let url = window.location.pathname + this.name + '/'
|
||||
let url = window.location.pathname
|
||||
if (this.$store.state.req.kind !== 'listing') {
|
||||
url = page.removeLastDir(url) + '/'
|
||||
}
|
||||
|
||||
url += this.name + '/'
|
||||
url = url.replace('//', '/')
|
||||
|
||||
// buttons.setLoading('newDir')
|
||||
|
||||
@@ -26,11 +26,19 @@ export default {
|
||||
event.preventDefault()
|
||||
if (this.new === '') return
|
||||
|
||||
let url = window.location.pathname
|
||||
if (this.$store.state.req.kind !== 'listing') {
|
||||
url = page.removeLastDir(url) + '/'
|
||||
}
|
||||
|
||||
url += this.name
|
||||
url = url.replace('//', '/')
|
||||
|
||||
// buttons.setLoading('newFile')
|
||||
webdav.create(window.location.pathname + this.name)
|
||||
webdav.create(url)
|
||||
.then(() => {
|
||||
// buttons.setDone('newFile')
|
||||
page.open(window.location.pathname + this.name)
|
||||
page.open(url)
|
||||
})
|
||||
.catch(e => {
|
||||
// buttons.setDone('newFile', false)
|
||||
|
||||
@@ -51,6 +51,7 @@ export default {
|
||||
},
|
||||
back: function (event) {
|
||||
let url = page.removeLastDir(window.location.pathname)
|
||||
if (url === '') url = '/'
|
||||
page.open(url)
|
||||
},
|
||||
allowEdit: function (event) {
|
||||
|
||||
@@ -94,9 +94,9 @@ nav .action {
|
||||
padding: .5em;
|
||||
}
|
||||
|
||||
nav>div {
|
||||
nav > .action:last-child,
|
||||
nav > div {
|
||||
border-top: 1px solid rgba(0, 0, 0, 0.05);
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
nav .action>* {
|
||||
@@ -123,4 +123,4 @@ main {
|
||||
margin: 0;
|
||||
padding: 0 1em;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -496,4 +496,4 @@ footer a:hover {
|
||||
-webkit-transform: rotate(-360deg);
|
||||
transform: rotate(-360deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user