Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[full-ci] Rename SimpleEditor to TextEditor #6763

Merged
merged 3 commits into from
Apr 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ config = {
"oC10Files1": [
"webUIFilesCopy",
"webUIFavorites",
"webUISimpleEditor",
"webUITextEditor",
],
"oC10Files2": [
"webUIFilesList",
Expand Down Expand Up @@ -265,7 +265,7 @@ config = {
"oC10XGAPortrait2": [
"webUISharingAcceptShares",
"webUISharingAcceptSharesToRoot",
"webUISimpleEditor",
"webUITextEditor",
"webUIWebdavLockProtection",
"webUIWebdavLocks",
"webUIMoveFilesFolders",
Expand Down Expand Up @@ -358,7 +358,7 @@ config = {
"oC10iPhone2": [
"webUISharingAcceptShares",
"webUISharingAcceptSharesToRoot",
"webUISimpleEditor",
"webUITextEditor",
"webUISharingInternalUsersBlacklisted",
"webUIWebdavLockProtection",
"webUIWebdavLocks",
Expand Down Expand Up @@ -434,7 +434,7 @@ config = {
"webUICreateFilesFolders",
"webUIDeleteFilesFolders",
"webUIFilesCopy",
"webUISimpleEditor",
"webUITextEditor",
],
"oCISFiles2": [
"webUIFilesList",
Expand Down Expand Up @@ -560,7 +560,7 @@ config = {
"webUIRestrictSharing",
"webUISharingAcceptShares",
"webUISharingAcceptSharesToRoot",
"webUISimpleEditor",
"webUITextEditor",
"webUISharingInternalUsersBlacklisted",
"webUIWebdavLockProtection",
"webUIWebdavLocks",
Expand Down Expand Up @@ -666,7 +666,7 @@ basicTestSuites = [
"webUIFilesList",
"webUIFilesSearch",
"webUILogin",
"webUISimpleEditor",
"webUITextEditor",
"webUIMoveFilesFolders",
"webUIOperationsWithFolderShares",
"webUIPreview",
Expand Down
2 changes: 1 addition & 1 deletion .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ labels:
color: "#ccf4ff"
- name: feature:files
color: "#d4c5f9"
- name: feature:simple-editor
- name: feature:text-editor
color: "#d4c5f9"
- name: feature:pdf-viewer
color: "#d4c5f9"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Enhancement: Simple Editor
Enhancement: Text Editor

Replace MarkdownEditor with SimpleEditor and add the following improvements:
Replace MarkdownEditor with Text Editor and add the following improvements:
* Disable preview for non md files (configurable)
* Data integrity checks (prevent exiting with unsaved changes)
* Better error information to the user
Expand All @@ -12,3 +12,4 @@ Replace MarkdownEditor with SimpleEditor and add the following improvements:

https://github.com/owncloud/web/pull/6667
https://github.com/owncloud/web/pull/6754
https://github.com/owncloud/web/pull/6763
2 changes: 1 addition & 1 deletion dev/docker/oc10.web.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"apps": [
"files",
"preview",
"simple-editor",
"text-editor",
"pdf-viewer",
"search"
],
Expand Down
2 changes: 1 addition & 1 deletion dev/docker/ocis.web.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
"apps": [
"files",
"simple-editor",
"text-editor",
"preview",
"pdf-viewer",
"search",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"packages/web-app-draw-io",
"packages/web-app-external",
"packages/web-app-files",
"packages/web-app-simple-editor",
"packages/web-app-text-editor",
"packages/web-app-preview",
"packages/web-app-user-management",
"packages/web-app-pdf-viewer",
Expand All @@ -26,7 +26,7 @@
"test:integration": "jest --config ./tests/integration/config/jest.config.js",
"test:e2e:cucumber": "NODE_TLS_REJECT_UNAUTHORIZED=0 cucumber-js --profile=e2e -f json:tests/e2e/cucumber/report/cucumber_report.json",
"test:unit": "NODE_OPTIONS=--unhandled-rejections=throw jest --coverage --config ./tests/unit/config/jest.config.js",
"licenses:check": "license-checker-rseidelsohn --summary --relativeLicensePath --onlyAllow 'Python-2.0;Apache*;Apache License, Version 2.0;Apache-2.0;Apache 2.0;Artistic-2.0;BSD;BSD-3-Clause;CC-BY-3.0;CC-BY-4.0;CC0-1.0;ISC;MIT;MPL-2.0;Public Domain;Unicode-TOU;Unlicense;WTFPL' --excludePackages 'draw-io;external;files;simple-editor;preview;owncloud-design-system;pdf-viewer;search;user-management;web-client;web-pkg;web-runtime'",
"licenses:check": "license-checker-rseidelsohn --summary --relativeLicensePath --onlyAllow 'Python-2.0;Apache*;Apache License, Version 2.0;Apache-2.0;Apache 2.0;Artistic-2.0;BSD;BSD-3-Clause;CC-BY-3.0;CC-BY-4.0;CC0-1.0;ISC;MIT;MPL-2.0;Public Domain;Unicode-TOU;Unlicense;WTFPL' --excludePackages 'draw-io;external;files;text-editor;preview;owncloud-design-system;pdf-viewer;search;user-management;web-client;web-pkg;web-runtime'",
"licenses:csv": "license-checker-rseidelsohn --relativeLicensePath --csv --out ./third-party-licenses/third-party-licenses.csv",
"licenses:save": "license-checker-rseidelsohn --relativeLicensePath --out /dev/null --files ./third-party-licenses/third-party-licenses"
},
Expand Down
20 changes: 10 additions & 10 deletions packages/web-app-files/tests/__fixtures__/fileActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ const meta = {
id: 'draw-io',
icon: 'grid'
},
'simple-editor': {
name: 'SimpleEditor',
id: 'simple-editor',
'text-editor': {
name: 'Text Editor',
id: 'text-editor',
icon: 'file-text'
}
}
Expand Down Expand Up @@ -49,12 +49,12 @@ const editors = [
routes
},
{
app: 'simple-editor',
app: 'text-editor',
extension: 'md',
handler: null,
icon: null,
newTab: false,
routeName: 'simple-editor',
routeName: 'text-editor',
routes
}
]
Expand Down Expand Up @@ -131,11 +131,11 @@ const fileActions = {
selector: '.oc-files-actions-delete-trigger'
},

'simple-editor': {
'text-editor': {
handler: jest.fn(),
label: () => 'Open in Simple Editor',
class: 'oc-files-actions-simple-editor-trigger',
selector: '.oc-files-actions-simple-editor-trigger',
label: () => 'Open in Text Editor',
class: 'oc-files-actions-text-editor-trigger',
selector: '.oc-files-actions-text-editor-trigger',
opensInNewWindow: true
},
'draw-io': {
Expand Down Expand Up @@ -165,7 +165,7 @@ const fileActions = {
exports.fileActions = fileActions

exports.getActions = function (actions = []) {
const defaultActions = ['download', 'simple-editor', 'draw-io', 'preview', 'navigate']
const defaultActions = ['download', 'text-editor', 'draw-io', 'preview', 'navigate']

const res = []
for (const key of actions) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const newFileHandlers = [
{
ext: 'txt',
action: {
app: 'simple-editor',
app: 'text-editor',
newTab: false,
extension: 'txt'
},
Expand All @@ -45,7 +45,7 @@ const newFileHandlers = [
{
ext: 'md',
action: {
app: 'simple-editor',
app: 'text-editor',
newTab: false,
extension: 'md'
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ const mockMenuSections = [
handler: jest.fn(),
label: () => 'Open in editor',
componentType: 'oc-button',
selector: '.oc-files-actions-simple-editor-trigger',
class: 'oc-files-actions-simple-editor-trigger'
selector: '.oc-files-actions-text-editor-trigger',
class: 'oc-files-actions-text-editor-trigger'
},
...exampleApps.map((app) => {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exports[`ContextActions menu items renders a list of actions for a file 1`] = `
<div id="oc-files-context-menu">
<oc-list-stub id="oc-files-context-actions-context" class="oc-files-context-actions oc-pb-s oc-files-context-actions-border">
<li class="oc-files-context-action oc-px-s oc-rounded"><button type="button" class="oc-button oc-rounded oc-button-s oc-button-justify-content-center oc-button-gap-m oc-button-passive oc-button-passive-raw oc-files-actions-simple-editor-trigger action-menu-item" data-testid="action-handler">
<li class="oc-files-context-action oc-px-s oc-rounded"><button type="button" class="oc-button oc-rounded oc-button-s oc-button-justify-content-center oc-button-gap-m oc-button-passive oc-button-passive-raw oc-files-actions-text-editor-trigger action-menu-item" data-testid="action-handler">
<oc-icon-stub name="file-text" filltype="line" accessiblelabel="" type="span" size="medium" variation="passive" color="" data-testid="action-icon"></oc-icon-stub> <span data-testid="action-label" class="oc-files-context-action-label">Open in editor</span>
<!---->
</button></li>
Expand Down Expand Up @@ -66,7 +66,7 @@ exports[`ContextActions menu items renders a list of actions for a file 1`] = `
exports[`ContextActions menu items renders a list of actions for a folder 1`] = `
<div id="oc-files-context-menu">
<oc-list-stub id="oc-files-context-actions-context" class="oc-files-context-actions oc-pb-s oc-files-context-actions-border">
<li class="oc-files-context-action oc-px-s oc-rounded"><button type="button" class="oc-button oc-rounded oc-button-s oc-button-justify-content-center oc-button-gap-m oc-button-passive oc-button-passive-raw oc-files-actions-simple-editor-trigger action-menu-item" data-testid="action-handler">
<li class="oc-files-context-action oc-px-s oc-rounded"><button type="button" class="oc-button oc-rounded oc-button-s oc-button-justify-content-center oc-button-gap-m oc-button-passive oc-button-passive-raw oc-files-actions-text-editor-trigger action-menu-item" data-testid="action-handler">
<oc-icon-stub name="file-text" filltype="line" accessiblelabel="" type="span" size="medium" variation="passive" color="" data-testid="action-icon"></oc-icon-stub> <span data-testid="action-label" class="oc-files-context-action-label">Open in editor</span>
<!---->
</button></li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ const filesPersonalRoute = { name: 'files-personal' }
const systemDefaultActions = [
[['copy']],
[['copy', 'move']],
[['copy', 'simple-editor']],
[['copy', 'move', 'download', 'simple-editor']]
[['copy', 'text-editor']],
[['copy', 'move', 'download', 'text-editor']]
]

describe('FileActions', () => {
Expand All @@ -32,7 +32,7 @@ describe('FileActions', () => {
jest.clearAllMocks()
})
it('renders action handlers as clickable elements', async () => {
const actions = ['copy', 'move', 'download', 'simple-editor']
const actions = ['copy', 'move', 'download', 'text-editor']
const wrapper = getWrapper(filesPersonalRoute, actions)

for (const button of actions) {
Expand Down
6 changes: 0 additions & 6 deletions packages/web-app-simple-editor/package.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[main]
host = https://www.transifex.com

[owncloud-web.simple-editor]
[owncloud-web.text-editor]
file_filter = locale/<lang>/LC_MESSAGES/app.po
minimum_perc = 0
source_file = template.pot
Expand Down
6 changes: 6 additions & 0 deletions packages/web-app-text-editor/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "text-editor",
"version": "0.0.0",
"description": "ownCloud Web simple text editor",
"license": "AGPL-3.0"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<main id="simple-editor" class="oc-mx-l oc-my-m">
<simple-editor-app-bar
<main id="text-editor" class="oc-mx-l oc-my-m">
<app-bar
:current-file-context="currentFileContext"
:is-loading="isLoading"
:is-dirty="isDirty"
Expand All @@ -19,7 +19,7 @@
<div class="oc-flex">
<div :class="showPreview ? 'oc-width-1-2' : 'oc-width-1-1'">
<oc-textarea
id="simple-editor-input"
id="text-editor-input"
v-model="currentContent"
name="input"
full-width
Expand All @@ -31,13 +31,13 @@
</div>
<div v-if="showPreview" class="oc-container oc-width-1-2">
<!-- eslint-disable-next-line vue/no-v-html -->
<div id="simple-editor-preview" v-html="renderedMarkdown" />
<div id="text-editor-preview" v-html="renderedMarkdown" />
</div>
</div>
</main>
</template>
<script>
import SimpleEditorAppBar from './SimpleEditorAppBar.vue'
import AppBar from './AppBar.vue'
import { useAppDefaults } from 'web-pkg/src/composables'
import { marked } from 'marked'
import sanitizeHtml from 'sanitize-html'
Expand All @@ -47,18 +47,18 @@ import { mapActions } from 'vuex'
import { DavPermission, DavProperty } from 'web-pkg/src/constants'

export default {
name: 'SimpleEditor',
name: 'TextEditor',
components: {
SimpleEditorAppBar
AppBar
},
beforeRouteLeave(_to, _from, next) {
if (this.isDirty) {
const modal = {
variation: 'danger',
icon: 'warning',
title: this.$gettext('Changes not saved'),
title: this.$gettext('Unsaved changes'),
message: this.$gettext('Your changes were not saved. Do you want to save them?'),
cancelText: this.$gettext('Not Save'),
cancelText: this.$gettext("Don't Save"),
confirmText: this.$gettext('Save'),
onCancel: () => {
this.hideModal()
Expand All @@ -77,7 +77,7 @@ export default {
},
setup() {
const defaults = useAppDefaults({
applicationName: 'simple-editor'
applicationName: 'text-editor'
})
const { applicationConfig, currentFileContext } = defaults
const serverContent = ref()
Expand Down Expand Up @@ -231,11 +231,11 @@ export default {
}
</script>
<style lang="scss" scoped>
#simple-editor-preview {
#text-editor-preview {
max-height: 80vh;
overflow-y: scroll;
}
#simple-editor-input {
#text-editor-input {
resize: vertical;
}
</style>
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<template>
<div id="simple-editor-app-bar" class="oc-app-bar oc-width-1-1 oc-my-s">
<div id="text-editor-app-bar" class="oc-app-bar oc-width-1-1 oc-my-s">
<oc-grid flex gutter="small">
<div class="oc-width-auto">
<oc-button
id="simple-editor-controls-save"
id="text-editor-controls-save"
:disabled="isReadOnly || !isDirty"
@click="$emit('save')"
>
Expand All @@ -12,10 +12,10 @@
<oc-spinner v-if="isLoading" :aria-label="$gettext('Loading editor content')" />
</div>
<div class="oc-width-expand oc-text-center">
<span id="simple-editor-file-path">{{ activeFilePath }}</span>
<span id="text-editor-file-path">{{ activeFilePath }}</span>
</div>
<div class="oc-width-auto oc-text-right">
<oc-button id="simple-editor-controls-close" @click="$emit('closeApp')">
<oc-button id="text-editor-controls-close" @click="$emit('closeApp')">
<oc-icon name="close" />
</oc-button>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import App from './App.vue'
import translations from '../l10n/translations'

// just a dummy function to trick gettext tools
function $gettext(msg) {
return msg
}

const routes = [
{
path: '/:filePath*',
component: App,
name: 'simple-editor',
name: 'text-editor',
meta: {
title: 'SimpleEditor',
title: $gettext('Text Editor'),
auth: false,
patchCleanPath: true
}
Expand All @@ -19,8 +24,8 @@ const fileExtensionConfig = {
}

const appInfo = {
name: 'SimpleEditor',
id: 'simple-editor',
name: $gettext('Text Editor'),
id: 'text-editor',
icon: 'file-text',
isFileEditor: true,
extensions: [
Expand Down
Loading