Skip to content

Commit

Permalink
[full-ci] Improvements to text/md editor (#6667)
Browse files Browse the repository at this point in the history
Rename and improve markdown editor
* Support for read-only files
* Disable preview for non md files (configurable)
* Data integrity checks (prevent exiting with unsaved changes)
* Better error information to the user
* Keyboard shortcut to save
* Rename Markdown Editor to Simple Editor

Co-authored-by: Benedikt Kulmann <benedikt@kulmann.biz>
  • Loading branch information
diocas and kulmann committed Apr 7, 2022
1 parent 8a1c04e commit 7568691
Show file tree
Hide file tree
Showing 29 changed files with 390 additions and 256 deletions.
12 changes: 6 additions & 6 deletions .drone.star
Expand Up @@ -78,7 +78,7 @@ config = {
"oC10Files1": [
"webUIFilesCopy",
"webUIFavorites",
"webUIMarkdownEditor",
"webUISimpleEditor",
],
"oC10Files2": [
"webUIFilesList",
Expand Down Expand Up @@ -265,7 +265,7 @@ config = {
"oC10XGAPortrait2": [
"webUISharingAcceptShares",
"webUISharingAcceptSharesToRoot",
"webUIMarkdownEditor",
"webUISimpleEditor",
"webUIWebdavLockProtection",
"webUIWebdavLocks",
"webUIMoveFilesFolders",
Expand Down Expand Up @@ -358,7 +358,7 @@ config = {
"oC10iPhone2": [
"webUISharingAcceptShares",
"webUISharingAcceptSharesToRoot",
"webUIMarkdownEditor",
"webUISimpleEditor",
"webUISharingInternalUsersBlacklisted",
"webUIWebdavLockProtection",
"webUIWebdavLocks",
Expand Down Expand Up @@ -434,7 +434,7 @@ config = {
"webUICreateFilesFolders",
"webUIDeleteFilesFolders",
"webUIFilesCopy",
"webUIMarkdownEditor",
"webUISimpleEditor",
],
"oCISFiles2": [
"webUIFilesList",
Expand Down Expand Up @@ -560,7 +560,7 @@ config = {
"webUIRestrictSharing",
"webUISharingAcceptShares",
"webUISharingAcceptSharesToRoot",
"webUIMarkdownEditor",
"webUISimpleEditor",
"webUISharingInternalUsersBlacklisted",
"webUIWebdavLockProtection",
"webUIWebdavLocks",
Expand Down Expand Up @@ -666,7 +666,7 @@ basicTestSuites = [
"webUIFilesList",
"webUIFilesSearch",
"webUILogin",
"webUIMarkdownEditor",
"webUISimpleEditor",
"webUIMoveFilesFolders",
"webUIOperationsWithFolderShares",
"webUIPreview",
Expand Down
2 changes: 1 addition & 1 deletion .github/settings.yml
Expand Up @@ -16,7 +16,7 @@ labels:
color: "#ccf4ff"
- name: feature:files
color: "#d4c5f9"
- name: feature:markdown-editor
- name: feature:simple-editor
color: "#d4c5f9"
- name: feature:pdf-viewer
color: "#d4c5f9"
Expand Down
13 changes: 13 additions & 0 deletions changelog/unreleased/enhancement-simple-editor
@@ -0,0 +1,13 @@
Enhancement: Simple Editor

Replace MarkdownEditor with SimpleEditor 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
* Keyboard shortcut to save
* Read-only mode
* Fix to open on non-authenticated public links
* Open other extensions (js, json, xml, py, php, yaml)
* UI polish

https://github.com/owncloud/web/pull/6667
2 changes: 1 addition & 1 deletion dev/docker/oc10.web.config.json
Expand Up @@ -8,7 +8,7 @@
"apps": [
"files",
"preview",
"markdown-editor",
"simple-editor",
"pdf-viewer",
"search"
],
Expand Down
2 changes: 1 addition & 1 deletion dev/docker/ocis.web.config.json
Expand Up @@ -16,7 +16,7 @@
},
"apps": [
"files",
"markdown-editor",
"simple-editor",
"preview",
"pdf-viewer",
"search",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -8,7 +8,7 @@
"packages/web-app-draw-io",
"packages/web-app-external",
"packages/web-app-files",
"packages/web-app-markdown-editor",
"packages/web-app-simple-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;markdown-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;simple-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
Expand Up @@ -14,9 +14,9 @@ const meta = {
id: 'draw-io',
icon: 'grid'
},
'markdown-editor': {
name: 'MarkdownEditor',
id: 'markdown-editor',
'simple-editor': {
name: 'SimpleEditor',
id: 'simple-editor',
icon: 'file-text'
}
}
Expand Down Expand Up @@ -49,12 +49,12 @@ const editors = [
routes
},
{
app: 'markdown-editor',
app: 'simple-editor',
extension: 'md',
handler: null,
icon: null,
newTab: false,
routeName: 'markdown-editor',
routeName: 'simple-editor',
routes
}
]
Expand Down Expand Up @@ -131,11 +131,11 @@ const fileActions = {
selector: '.oc-files-actions-delete-trigger'
},

'markdown-editor': {
'simple-editor': {
handler: jest.fn(),
label: () => 'Open in Markdown Editor',
class: 'oc-files-actions-markdown-editor-trigger',
selector: '.oc-files-actions-markdown-editor-trigger',
label: () => 'Open in Simple Editor',
class: 'oc-files-actions-simple-editor-trigger',
selector: '.oc-files-actions-simple-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', 'markdown-editor', 'draw-io', 'preview', 'navigate']
const defaultActions = ['download', 'simple-editor', 'draw-io', 'preview', 'navigate']

const res = []
for (const key of actions) {
Expand Down
Expand Up @@ -36,7 +36,7 @@ const newFileHandlers = [
{
ext: 'txt',
action: {
app: 'markdown-editor',
app: 'simple-editor',
newTab: false,
extension: 'txt'
},
Expand All @@ -45,7 +45,7 @@ const newFileHandlers = [
{
ext: 'md',
action: {
app: 'markdown-editor',
app: 'simple-editor',
newTab: false,
extension: 'md'
},
Expand Down
Expand Up @@ -30,8 +30,8 @@ const mockMenuSections = [
handler: jest.fn(),
label: () => 'Open in editor',
componentType: 'oc-button',
selector: '.oc-files-actions-markdown-editor-trigger',
class: 'oc-files-actions-markdown-editor-trigger'
selector: '.oc-files-actions-simple-editor-trigger',
class: 'oc-files-actions-simple-editor-trigger'
},
...exampleApps.map((app) => {
return {
Expand Down
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-markdown-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-simple-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-markdown-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-simple-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 @@ -21,8 +21,8 @@ const filesPersonalRoute = { name: 'files-personal' }
const systemDefaultActions = [
[['copy']],
[['copy', 'move']],
[['copy', 'markdown-editor']],
[['copy', 'move', 'download', 'markdown-editor']]
[['copy', 'simple-editor']],
[['copy', 'move', 'download', 'simple-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', 'markdown-editor']
const actions = ['copy', 'move', 'download', 'simple-editor']
const wrapper = getWrapper(filesPersonalRoute, actions)

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

This file was deleted.

137 changes: 0 additions & 137 deletions packages/web-app-markdown-editor/src/App.vue

This file was deleted.

@@ -1,7 +1,7 @@
[main]
host = https://www.transifex.com

[owncloud-web.markdown-editor]
[owncloud-web.simple-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-simple-editor/package.json
@@ -0,0 +1,6 @@
{
"name": "simple-editor",
"version": "0.0.0",
"description": "ownCloud web simple-editor",
"license": "AGPL-3.0"
}

0 comments on commit 7568691

Please sign in to comment.