diff options
author | Julius Härtl <jus@bitgrid.net> | 2019-10-05 11:35:43 +0300 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2019-10-05 11:35:43 +0300 |
commit | 7805c98a4b1530e224a4a5773e6800851d9404b1 (patch) | |
tree | d646f6a06ff5b9b226c2d9f2581e7ccb413ba5fd | |
parent | 69b3157dd9706e004a43cacbde9672478236f9e2 (diff) |
Fix eslint
Signed-off-by: Julius Härtl <jus@bitgrid.net>
-rw-r--r-- | package.json | 1 | ||||
-rw-r--r-- | src/components/EditorWrapper.vue | 24 | ||||
-rw-r--r-- | src/components/FilesEditor.vue | 7 | ||||
-rw-r--r-- | src/components/GuestNameDialog.vue | 2 | ||||
-rw-r--r-- | src/components/MenuBar.vue | 34 | ||||
-rw-r--r-- | src/components/MenuBubble.vue | 16 | ||||
-rw-r--r-- | src/components/PublicFilesEditor.vue | 13 | ||||
-rw-r--r-- | src/components/ReadOnlyEditor.vue | 5 | ||||
-rw-r--r-- | src/components/SessionList.vue | 9 | ||||
-rw-r--r-- | src/nodes/ImageView.vue | 14 |
10 files changed, 80 insertions, 45 deletions
diff --git a/package.json b/package.json index 53cf412ae..c792b9261 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/components/EditorWrapper.vue b/src/components/EditorWrapper.vue index 8b847c528..18d2d4118 100644 --- a/src/components/EditorWrapper.vue +++ b/src/components/EditorWrapper.vue @@ -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() diff --git a/src/components/FilesEditor.vue b/src/components/FilesEditor.vue index f951fa7d5..7e301de15 100644 --- a/src/components/FilesEditor.vue +++ b/src/components/FilesEditor.vue @@ -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> diff --git a/src/components/GuestNameDialog.vue b/src/components/GuestNameDialog.vue index f65824c9a..92525c3cb 100644 --- a/src/components/GuestNameDialog.vue +++ b/src/components/GuestNameDialog.vue @@ -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> diff --git a/src/components/MenuBar.vue b/src/components/MenuBar.vue index bacbe04ed..37822a76f 100644 --- a/src/components/MenuBar.vue +++ b/src/components/MenuBar.vue @@ -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> diff --git a/src/components/MenuBubble.vue b/src/components/MenuBubble.vue index 922b45840..3e421ef73 100644 --- a/src/components/MenuBubble.vue +++ b/src/components/MenuBubble.vue @@ -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> diff --git a/src/components/PublicFilesEditor.vue b/src/components/PublicFilesEditor.vue index b50b937bb..b2e4a0b27 100644 --- a/src/components/PublicFilesEditor.vue +++ b/src/components/PublicFilesEditor.vue @@ -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') diff --git a/src/components/ReadOnlyEditor.vue b/src/components/ReadOnlyEditor.vue index cdcbb0c91..43b4eee74 100644 --- a/src/components/ReadOnlyEditor.vue +++ b/src/components/ReadOnlyEditor.vue @@ -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 }) diff --git a/src/components/SessionList.vue b/src/components/SessionList.vue index 8662c252b..c2d97605e 100644 --- a/src/components/SessionList.vue +++ b/src/components/SessionList.vue @@ -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> diff --git a/src/nodes/ImageView.vue b/src/nodes/ImageView.vue index dcd0f57c2..c51ac0380 100644 --- a/src/nodes/ImageView.vue +++ b/src/nodes/ImageView.vue @@ -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> |