Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2019-10-16 11:47:15 +02:00
Родитель 38444b9657
Коммит b1ba3db46e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4C614C6ED2CDE6DF
4 изменённых файлов: 25 добавлений и 33 удалений

Просмотреть файл

@ -212,5 +212,4 @@ div.ProseMirror {
color: var(--color-text-maxcontrast); color: var(--color-text-maxcontrast);
pointer-events: none; pointer-events: none;
height: 0; height: 0;
font-style: italic;
} }

Просмотреть файл

@ -79,7 +79,7 @@ const createEditor = ({ content, onInit, onUpdate, extensions, enableRichEditing
new Image(), new Image(),
new Placeholder({ new Placeholder({
emptyNodeClass: 'is-empty', emptyNodeClass: 'is-empty',
emptyNodeText: 'Write something …', emptyNodeText: 'Add notes, lists or links …',
showOnlyWhenEditable: true showOnlyWhenEditable: true
}) })
] ]

Просмотреть файл

@ -22,10 +22,11 @@
import FilesEditor from './components/FilesEditor' import FilesEditor from './components/FilesEditor'
import PreviewPlugin from './files/PreviewPlugin' import PreviewPlugin from './files/PreviewPlugin'
import RichWorkspace from './views/RichWorkspace'
import { registerFileActionFallback, registerFileCreate } from './helpers/files' import { registerFileActionFallback, registerFileCreate } from './helpers/files'
import { openMimetypesMarkdown, openMimetypesPlainText } from './helpers/mime' import { openMimetypesMarkdown, openMimetypesPlainText } from './helpers/mime'
__webpack_nonce__ = btoa(OC.requestToken) // eslint-disable-line __webpack_nonce__ = btoa(OC.requestToken) // eslint-disable-line
__webpack_public_path__ = OC.linkTo('text', 'js/') // eslint-disable-line __webpack_public_path__ = OC.linkTo('text', 'js/') // eslint-disable-line
@ -67,26 +68,22 @@ const FilesPlugin = {
render: (fileList) => { render: (fileList) => {
const RichWorkspace = import(/* webpackChunkName: "richworkspace" */'./views/RichWorkspace') import('vue').then((module) => {
const Vue = import('vue') const Vue = module.default
FilesPlugin.el.id = 'files-workspace-wrapper' FilesPlugin.el.id = 'files-workspace-wrapper'
Vue.prototype.t = window.t Vue.prototype.t = window.t
Vue.prototype.n = window.n Vue.prototype.n = window.n
Vue.prototype.OCA = window.OCA Vue.prototype.OCA = window.OCA
const View = Vue.extend(RichWorkspace) const View = Vue.extend(RichWorkspace)
const vm = new View({ const vm = new View({
propsData: { propsData: {
path: fileList.getCurrentDirectory() path: fileList.getCurrentDirectory()
} }
}).$mount(FilesPlugin.el) }).$mount(FilesPlugin.el)
fileList.$el.on('changeDirectory', data => { fileList.$el.on('changeDirectory', data => {
vm.path = data.dir.toString() vm.path = data.dir.toString()
vm.changeDirectory({
dir: data.dir,
fileList
}) })
// TODO Switch to path/README.md
}) })
} }
} }

Просмотреть файл

@ -23,10 +23,9 @@
<template> <template>
<div id="rich-workspace" :class="{'icon-loading': !loaded || !ready }"> <div id="rich-workspace" :class="{'icon-loading': !loaded || !ready }">
<div v-if="!file || (autofocus && !ready)" class="empty-workspace" @click="createNew"> <div v-if="!file || (autofocus && !ready)" class="empty-workspace" @click="createNew">
<i>{{ t('text', 'Click to enter notes, lists or links …') }}</i> <p class="placeholder">
</div> {{ t('text', 'Add notes, lists or links …') }}
<div v-if="(file && !ready)" class="empty-workspace"> </p>
<i>{{ t('text', 'Write something …') }}</i>
</div> </div>
<EditorWrapper v-if="file" <EditorWrapper v-if="file"
@ -44,7 +43,7 @@
export default { export default {
name: 'RichWorkspace', name: 'RichWorkspace',
components: { components: {
EditorWrapper: () => import(/* webpackChunkName: "editor" */'./EditorWrapper') EditorWrapper: () => import(/* webpackChunkName: "editor" */'./../components/EditorWrapper')
}, },
props: { props: {
path: { path: {
@ -69,9 +68,6 @@ export default {
this.getFileInfo() this.getFileInfo()
}, },
methods: { methods: {
changeDirectory({ dir, fileList }) {
console.log('vue cchangeDirectory', dir, fileList)
},
getFileInfo() { getFileInfo() {
this.loaded = false this.loaded = false
this.autofocus = false this.autofocus = false
@ -87,7 +83,7 @@ export default {
}) })
}, },
createNew() { createNew() {
window.FileList.createFile('README.md', { scrollTo: false }).then((status, data) => { window.FileList.createFile('README.md', { scrollTo: false, animate: false }).then((status, data) => {
this.getFileInfo() this.getFileInfo()
this.autofocus = true this.autofocus = true
}) })
@ -98,15 +94,16 @@ export default {
<style scoped> <style scoped>
#rich-workspace { #rich-workspace {
padding: 0 20px; padding: 0 60px;
min-height: 90px; min-height: 90px;
} }
.empty-workspace { .empty-workspace {
margin-top: 54px; margin-top: 54px;
color: var(--color-text-maxcontrast); color: var(--color-text-maxcontrast);
height: 0; height: 0;
font-style: italic;
} }
#rich-workspace::v-deep div[contenteditable=false] { #rich-workspace::v-deep div[contenteditable=false] {
width: 100%; width: 100%;
padding: 0px; padding: 0px;
@ -135,6 +132,5 @@ export default {
#rich-workspace::v-deep .editor__content { #rich-workspace::v-deep .editor__content {
margin: 0; margin: 0;
max-width: 100%;
} }
</style> </style>