Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2019-10-05 10:35:43 +02:00
Родитель 69b3157dd9
Коммит 7805c98a4b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4C614C6ED2CDE6DF
10 изменённых файлов: 80 добавлений и 45 удалений

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

@ -24,6 +24,7 @@
},
"dependencies": {
"@nextcloud/axios": "^0.4.1",
"escape-html": "^1.0.3",
"highlight.js": "^9.15.10",
"markdown-it": "^10.0.0",
"nextcloud-axios": "^0.2.1",

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

@ -32,30 +32,34 @@
</div>
<div v-if="currentSession && active" id="editor-wrapper" :class="{'has-conflicts': hasSyncCollission, 'icon-loading': !initialLoading, 'richEditor': isRichEditor}">
<div id="editor">
<menu-bar v-if="!syncError && !readOnly" ref="menubar" :editor="tiptap"
<MenuBar v-if="!syncError && !readOnly"
ref="menubar"
:editor="tiptap"
:is-rich-editor="isRichEditor">
<div v-if="currentSession && active" id="editor-session-list">
<div v-tooltip="lastSavedStatusTooltip" class="save-status" :class="lastSavedStatusClass">
{{ lastSavedStatus }}
</div>
<session-list :sessions="filteredSessions">
<guest-name-dialog v-if="isPublic && currentSession.guestName" :sync-service="syncService" />
</session-list>
<SessionList :sessions="filteredSessions">
<GuestNameDialog v-if="isPublic && currentSession.guestName" :sync-service="syncService" />
</SessionList>
</div>
</menu-bar>
<menu-bubble v-if="!readOnly && isRichEditor" :editor="tiptap" />
<editor-content v-show="initialLoading" class="editor__content" :editor="tiptap" />
</MenuBar>
<MenuBubble v-if="!readOnly && isRichEditor" :editor="tiptap" />
<EditorContent v-show="initialLoading" class="editor__content" :editor="tiptap" />
</div>
<read-only-editor v-if="hasSyncCollission" :content="syncError.data.outsideChange"
<ReadOnlyEditor v-if="hasSyncCollission"
:content="syncError.data.outsideChange"
:is-rich-editor="isRichEditor" />
</div>
<collision-resolve-dialog v-if="hasSyncCollission && !readOnly" @resolveUseThisVersion="resolveUseThisVersion" @resolveUseServerVersion="resolveUseServerVersion" />
<CollisionResolveDialog v-if="hasSyncCollission && !readOnly" @resolveUseThisVersion="resolveUseThisVersion" @resolveUseServerVersion="resolveUseServerVersion" />
</div>
</template>
<script>
import Vue from 'vue'
import escapeHtml from 'escape-html'
import { SyncService, ERROR_TYPE } from './../services/SyncService'
import { endpointUrl, getRandomGuestName } from './../helpers'
@ -264,7 +268,7 @@ export default {
this.hasConnectionIssue = false
loadSyntaxHighlight(extensionHighlight[this.fileExtension] ? extensionHighlight[this.fileExtension] : this.fileExtension).then((languages) => {
this.tiptap = createEditor({
content: this.isRichEditor ? markdownit.render(documentSource) : '<pre>' + window.escapeHTML(documentSource) + '</pre>',
content: this.isRichEditor ? markdownit.render(documentSource) : '<pre>' + escapeHtml(documentSource) + '</pre>',
onInit: ({ state }) => {
this.syncService.state = state
this.syncService.startSync()

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

@ -21,8 +21,11 @@
-->
<template>
<editor-wrapper :file-id="fileId" :relative-path="davPath" :active="active"
:share-token="shareToken" :mime="mime" />
<EditorWrapper :file-id="fileId"
:relative-path="davPath"
:active="active"
:share-token="shareToken"
:mime="mime" />
</template>
<script>

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

@ -22,7 +22,7 @@
<template>
<form v-tooltip="t('text', 'Enter your name so other users can see who is editing')" class="guest-name-dialog" @submit.prevent="setGuestName()">
<label><avatar :url="avatarUrl" :disable-tooltip="true" :size="32" /></label>
<label><Avatar :url="avatarUrl" :disable-tooltip="true" :size="32" /></label>
<input v-model="guestName" type="text" :aria-label="t('text', 'Edit guest name')">
<input type="submit" class="icon-confirm" :aria-label="t('text', 'Save guest name')">
</form>

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

@ -21,46 +21,54 @@
-->
<template>
<editor-menu-bar v-slot="{ commands, isActive }" :editor="editor">
<EditorMenuBar v-slot="{ commands, isActive }" :editor="editor">
<div class="menubar">
<div v-if="isRichEditor" ref="menubar" class="menubar-icons">
<template v-for="(icon, $index) in allIcons">
<button v-if="icon.class" v-show="$index < iconCount" :key="icon.label"
<button v-if="icon.class"
v-show="$index < iconCount"
:key="icon.label"
:title="icon.label"
:class="getIconClasses(isActive, icon)" @click="clickIcon(commands, icon)" />
:class="getIconClasses(isActive, icon)"
@click="clickIcon(commands, icon)" />
<template v-else>
<div v-show="$index < iconCount" :key="icon.label" v-click-outside="() => hideChildMenu(icon)"
<div v-show="$index < iconCount"
:key="icon.label"
v-click-outside="() => hideChildMenu(icon)"
class="submenu">
<button :class="childIconClass(isActive, icon.children, )"
:title="icon.label"
@click.prevent="toggleChildMenu(icon)" />
<div :class="{open: isChildMenuVisible(icon)}" class="popovermenu menu-center">
<popover-menu :menu="childPopoverMenu(isActive, commands, icon.children, icon)" />
<PopoverMenu :menu="childPopoverMenu(isActive, commands, icon.children, icon)" />
</div>
</div>
</template>
</template>
<actions>
<Actions>
<template v-for="(icon, $index) in allIcons">
<action-button v-if="icon.class && isHiddenInMenu($index)" :key="icon.class"
:icon="icon.class" @click="clickIcon(commands, icon)">
<ActionButton v-if="icon.class && isHiddenInMenu($index)"
:key="icon.class"
:icon="icon.class"
@click="clickIcon(commands, icon)">
{{ icon.label }}
</action-button>
</ActionButton>
<template v-else-if="!icon.class && isHiddenInMenu($index)">
<action-button v-for="childIcon in icon.children" :key="childIcon.class"
<ActionButton v-for="childIcon in icon.children"
:key="childIcon.class"
:icon="childIcon.class"
@click="clickIcon(commands, childIcon)">
{{ childIcon.label }}
</action-button>
</ActionButton>
</template>
</template>
</actions>
</Actions>
</div>
<slot>
Left side
</slot>
</div>
</editor-menu-bar>
</EditorMenuBar>
</template>
<script>

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

@ -21,12 +21,18 @@
-->
<template>
<editor-menu-bubble v-slot="{ commands, isActive, getMarkAttrs, menu }" class="menububble"
:editor="editor" @hide="hideLinkMenu">
<EditorMenuBubble v-slot="{ commands, isActive, getMarkAttrs, menu }"
class="menububble"
:editor="editor"
@hide="hideLinkMenu">
<div class="menububble" :class="{ 'is-active': menu.isActive }" :style="`left: ${menu.left}px; bottom: ${menu.bottom}px;`">
<form v-if="linkMenuIsActive" class="menububble__form" @submit.prevent="setLinkUrl(commands.link, linkUrl)">
<input ref="linkInput" v-model="linkUrl" class="menububble__input"
type="text" placeholder="https://" @keydown.esc="hideLinkMenu">
<input ref="linkInput"
v-model="linkUrl"
class="menububble__input"
type="text"
placeholder="https://"
@keydown.esc="hideLinkMenu">
<button class="menububble__button icon-confirm" type="button" @click="setLinkUrl(commands.link, linkUrl)" />
</form>
@ -40,7 +46,7 @@
</button>
</template>
</div>
</editor-menu-bubble>
</EditorMenuBubble>
</template>
<script>

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

@ -21,17 +21,20 @@
-->
<template>
<modal v-if="active" :title="fileName" @close="close">
<editor-wrapper :file-id="fileId" :relative-path="relativePath" :active="active"
:share-token="shareToken" :mime="mimeType" />
</modal>
<Modal v-if="active" :title="fileName" @close="close">
<EditorWrapper :file-id="fileId"
:relative-path="relativePath"
:active="active"
:share-token="shareToken"
:mime="mimeType" />
</Modal>
</template>
<script>
import Modal from 'nextcloud-vue/dist/Components/Modal'
export default {
name: 'FilesEditor',
name: 'PublicFilesEditor',
components: {
Modal,
EditorWrapper: () => import(/* webpackChunkName: "editor" */'./EditorWrapper')

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

@ -21,11 +21,12 @@
-->
<template>
<editor-content v-if="editor" id="read-only-editor" :editor="editor" />
<EditorContent v-if="editor" id="read-only-editor" :editor="editor" />
</template>
<script>
import { EditorContent } from 'tiptap'
import escapeHtml from 'escape-html'
import { createEditor, markdownit } from '../EditorFactory'
export default {
@ -48,7 +49,7 @@ export default {
},
mounted() {
this.editor = createEditor({
content: this.isRichEditor ? markdownit.render(this.content) : '<pre>' + window.escapeHTML(this.content) + '</pre>',
content: this.isRichEditor ? markdownit.render(this.content) : '<pre>' + escapeHtml(this.content) + '</pre>',
enableRichEditing: this.isRichEditor
})
this.editor.setOptions({ editable: false })

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

@ -24,12 +24,15 @@
<div class="session-list">
<div v-tooltip.left="editorsTooltip" class="avatar-list" @click="popoverVisible=!popoverVisible">
<div v-if="sessionsPopover.length > 0" class="avatardiv icon-more" />
<avatar v-for="session in sessionsVisible" :key="session.id"
:url="avatarUrl(session)" :disable-tooltip="true" :style="sessionStyle(session)"
<Avatar v-for="session in sessionsVisible"
:key="session.id"
:url="avatarUrl(session)"
:disable-tooltip="true"
:style="sessionStyle(session)"
:size="32" />
</div>
<div v-show="popoverVisible" class="popovermenu menu-right">
<popover-menu :menu="sessionsPopover" />
<PopoverMenu :menu="sessionsPopover" />
<slot />
</div>
</div>

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

@ -24,12 +24,16 @@
<div class="image" :class="{'icon-loading': !loaded}" :data-src="src">
<div v-if="imageLoaded && isSupportedImage">
<transition name="fade">
<img v-show="loaded" :src="src"
class="image__main" @load="onLoaded">
<img v-show="loaded"
:src="src"
class="image__main"
@load="onLoaded">
</transition>
<transition name="fade">
<div v-show="loaded" class="image__caption">
<input ref="altInput" type="text" :value="alt"
<input ref="altInput"
type="text"
:value="alt"
@keyup.enter="updateAlt()">
</div>
</transition>
@ -44,7 +48,9 @@
</div>
</transition><transition name="fade">
<div v-show="loaded" class="image__caption">
<input ref="altInput" type="text" :value="alt"
<input ref="altInput"
type="text"
:value="alt"
@keyup.enter="updateAlt()">
</div>
</transition>