Skip to content

Commit 20138c3

Browse files
Merge pull request #7452 from nextcloud/chore/organize-imports
Use prettier everywhere
2 parents ed859fc + 644799c commit 20138c3

230 files changed

Lines changed: 4322 additions & 3533 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.cjs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,14 @@
55

66
module.exports = {
77
root: true,
8-
extends: [
9-
'@nextcloud',
10-
'prettier',
11-
],
12-
"overrides": [
8+
extends: ['@nextcloud', 'prettier'],
9+
overrides: [
1310
{
14-
"files": ["**/*.vue"],
15-
"rules": {
16-
"vue/first-attribute-linebreak": "off"
17-
}
18-
}
11+
files: ['**/*.vue'],
12+
rules: {
13+
'vue/first-attribute-linebreak': 'off',
14+
},
15+
},
1916
],
2017
rules: {
2118
'import/no-unresolved': [1, { ignore: ['\\.svg\\?raw$'] }],

.git-blame-ignore-revs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@
66

77
# Introduce prettier
88
810eb74a3f5502ef6485efdda7066c6848878bff
9+
0d4ada6304f951cdf28b2d045f7fc56629807c11
10+
eef5dde0838f4e80a420eec19442f9d73533e413

.prettierignore

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,21 @@
1010
**/node_modules
1111
**/vendor
1212

13-
# Compiled JS output
13+
# Compiled output
1414
js/
15+
css/
1516

1617
# PHP
1718
lib/
18-
**/*.php
19+
**/*.php
20+
composer/
21+
composer.lock
22+
23+
# Translations
24+
l10n/
25+
26+
# Github files
27+
.github/
28+
29+
# Test fixtures
30+
**/fixtures

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## 1.0.2
44

55
### Fixed
6+
67
- Improved dynamic chunk loading
78
- Add translations and fix wording for menu bar icons
89
- Fix network error handling
@@ -12,10 +13,12 @@
1213
## 1.0.1
1314

1415
### Added
16+
1517
- Implement proper plain text handling
1618
- Add translations
1719

1820
### Fixed
21+
1922
- Fix document loading caused by wrong step order
2023
- Properly register file action when viewer is disabled
2124
- Require at least 16.0.1

README.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
- SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
33
- SPDX-License-Identifier: AGPL-3.0-or-later
44
-->
5+
56
# Nextcloud Text
7+
68
[![REUSE status](https://api.reuse.software/badge/github.com/nextcloud/text)](https://api.reuse.software/info/github.com/nextcloud/text)
79
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/nextcloud/text/node.yml?branch=main)
810
[![Start contributing](https://img.shields.io/github/issues/nextcloud/text/good%20first%20issue?color=7057ff&label=Contribute)](https://github.com/nextcloud/text/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3A%22good+first+issue%22)
911

10-
1112
**📑 Collaborative document editing!**
1213

1314
![](img/screenshots/screenshot1.png)
@@ -51,20 +52,20 @@ To use the advantages of `vite serve` with hot module replacement (HMR) and not
5152

5253
1. Configure your webserver to redirect requests to `/apps/text/` to the vite serve server.
5354
When using [nextcloud-docker-dev](https://github.com/juliusknorr/nextcloud-docker-dev), add the following snippet to `data/nginx/vhost.d/nextcloud.local` and restart the proxy container. You might have to replace `/apps/text/` with e.g. `/apps-extra/text/` depending on where the text app resides in your dev setup.
54-
```
55-
location /apps/text/ {
56-
proxy_pass http://host.docker.internal:5173/apps/text/;
57-
# fallback to nextcloud server if vite serve doesn't answer
58-
error_page 502 = @fallback;
59-
}
60-
location @fallback {
61-
proxy_pass http://nextcloud.local;
62-
}
63-
```
55+
```
56+
location /apps/text/ {
57+
proxy_pass http://host.docker.internal:5173/apps/text/;
58+
# fallback to nextcloud server if vite serve doesn't answer
59+
error_page 502 = @fallback;
60+
}
61+
location @fallback {
62+
proxy_pass http://nextcloud.local;
63+
}
64+
```
6465
2. Run `npm run serve` to start the vite serve server. If text resides somewhere else than `/apps/text`, run e.g. `BASE=/apps-extra/text npm run serve`.
6566
6667
Afterwards all changes to the code will apply to the application in your browser automatically thanks to hot module replacement (HMR).
67-
68+
6869
### 🧙 Advanced development stuff
6970
7071
To build the Javascript whenever you make changes, instead of the full `make` you can also run `npm run build`. Or run `npm run watch` to rebuild on every file save.
@@ -90,7 +91,6 @@ Or you might set the `CYPRESS_baseUrl` environment variable for a custom nextclo
9091
- Once that is there, please open a pull request to add them to https://github.com/nextcloud/text/blob/12df66ffdd3d71cc696438e2e4ec60fa17b89a64/src/helpers/mime.js#L35-L61
9192
- You can test them like other mime types in cypress/e2e/files.spec.js
9293
93-
9494
## 🛠️ Integrate text in your app
9595
9696
## Load the editor
@@ -111,7 +111,6 @@ if (class_exists(LoadEditor::class)) {
111111

112112
Make sure to check if OCA.Text is available as the Text app needs to be enabled. If you want your app to work without Text being installed, you will need to provide an editor fallback on your own.
113113

114-
115114
```js
116115
window.OCA.Text.createEditor({
117116
el: document.getElementById('my-editor-div'),

codecov.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
coverage:
2-
status:
3-
project:
4-
default:
5-
threshold: 0
6-
paths:
7-
- "src"
8-
only_pulls: true
2+
status:
3+
project:
4+
default:
5+
threshold: 0
6+
paths:
7+
- 'src'
8+
only_pulls: true

cypress.config.mjs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
55

6+
import vue from '@vitejs/plugin-vue2'
67
import { defineConfig } from 'cypress'
78
import cypressSplit from 'cypress-split'
89
import { configureVisualRegression } from 'cypress-visual-regression/dist/plugin'
910
import vitePreprocessor from 'cypress-vite'
1011
import { nodePolyfills } from 'vite-plugin-node-polyfills'
11-
import vue from '@vitejs/plugin-vue2'
1212

1313
export default defineConfig({
1414
projectId: 'hx9gqy',
@@ -25,17 +25,22 @@ export default defineConfig({
2525
visualRegressionType: 'regression',
2626
},
2727
setupNodeEvents(on, config) {
28-
on('file:preprocessor', vitePreprocessor({
29-
plugins: [vue(), nodePolyfills()],
30-
configFile: false,
31-
}))
28+
on(
29+
'file:preprocessor',
30+
vitePreprocessor({
31+
plugins: [vue(), nodePolyfills()],
32+
configFile: false,
33+
}),
34+
)
3235
cypressSplit(on, config)
3336
configureVisualRegression(on)
3437

3538
// Disable spell checking to prevent rendering differences
3639
on('before:browser:launch', (browser, launchOptions) => {
3740
if (browser.family === 'chromium' && browser.name !== 'electron') {
38-
launchOptions.preferences.default['browser.enable_spellchecking'] = false
41+
launchOptions.preferences.default[
42+
'browser.enable_spellchecking'
43+
] = false
3944
return launchOptions
4045
}
4146

@@ -58,14 +63,14 @@ export default defineConfig({
5863
},
5964
component: {
6065
devServer: {
61-
framework: "vue",
62-
bundler: "vite",
66+
framework: 'vue',
67+
bundler: 'vite',
6368
},
6469
},
6570
retries: {
6671
runMode: 2,
6772
// do not retry in `cypress open`
6873
openMode: 0,
6974
},
70-
'numTestsKeptInMemory': 5,
75+
numTestsKeptInMemory: 5,
7176
})

cypress/.eslintrc.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
{
2-
"extends": [
3-
"plugin:cypress/recommended"
4-
]
2+
"extends": ["plugin:cypress/recommended"]
53
}

cypress/README.md

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,37 @@
44
-->
55

66
# Cypress tests
7+
78
There are some custom cypress commands available making it easier to write tests,
89
for example you can get the editor content and insert text by using
910

1011
```js
11-
cy.getContent()
12-
.type('some test')
12+
cy.getContent().type('some test')
1313
```
1414

1515
### Available custom commands
16-
| Command | Function | Parameters |
17-
| -------------------- | ---------------------- | ----------------------------------- |
18-
| `uploadFile` | Upload file | `fileName`, `mimeType`, `target` |
19-
| `createFile` | Create file | `target`, `content`, `mimeType` |
20-
| `moveFile` | Move a file | `path`, `destinationPath` |
21-
| `copyFile` | Copy file | `path`, `destinationPath` |
22-
| `createFolder` | Create a folder | `dirName` |
23-
| `shareFileToUser` | Share a file with user | `userId`, `password`, `path`, `targetUserId`|
24-
| `openFile` | Open file in Viewer / Editor | `fileName`, `clickParams` |
25-
| `closeFile` | Close the current file | |
26-
| `getFile` | Get file list element of file | `fileName` |
27-
| `deleteFile` | Remove a file | `fileName` |
28-
| `reloadFileList` | Refresh the file list | |
29-
| `getEditor` | Get TipTap Editor element | |
30-
| `getContent` | Get editor content | |
31-
| `clearContent` | Clear the editor content | |
32-
| `getMenu` | Get editor menu bar | |
33-
| `getMenuEntry` | Same as `getActionEntry` but also searches the overflow menu | `name` |
34-
| `getSubmenuEntry` | Open parent menu and then return sub menu entry | `parent`, `name` |
35-
| `getActionEntry` | Get menu entry | `name` |
36-
| `getActionSubEntry` | Get submenu entry (after menu clicked) | `name` |
37-
| `openWorkspace` | Open workspace and return Editor content | |
16+
17+
| Command | Function | Parameters |
18+
| ------------------- | ------------------------------------------------------------ | -------------------------------------------- |
19+
| `uploadFile` | Upload file | `fileName`, `mimeType`, `target` |
20+
| `createFile` | Create file | `target`, `content`, `mimeType` |
21+
| `moveFile` | Move a file | `path`, `destinationPath` |
22+
| `copyFile` | Copy file | `path`, `destinationPath` |
23+
| `createFolder` | Create a folder | `dirName` |
24+
| `shareFileToUser` | Share a file with user | `userId`, `password`, `path`, `targetUserId` |
25+
| `openFile` | Open file in Viewer / Editor | `fileName`, `clickParams` |
26+
| `closeFile` | Close the current file | |
27+
| `getFile` | Get file list element of file | `fileName` |
28+
| `deleteFile` | Remove a file | `fileName` |
29+
| `reloadFileList` | Refresh the file list | |
30+
| `getEditor` | Get TipTap Editor element | |
31+
| `getContent` | Get editor content | |
32+
| `clearContent` | Clear the editor content | |
33+
| `getMenu` | Get editor menu bar | |
34+
| `getMenuEntry` | Same as `getActionEntry` but also searches the overflow menu | `name` |
35+
| `getSubmenuEntry` | Open parent menu and then return sub menu entry | `parent`, `name` |
36+
| `getActionEntry` | Get menu entry | `name` |
37+
| `getActionSubEntry` | Get submenu entry (after menu clicked) | `name` |
38+
| `openWorkspace` | Open workspace and return Editor content | |
3839

3940
We also use some commands from the [`@nextcloud/cypress`](https://github.com/nextcloud/nextcloud-cypress) package.

cypress/component/editor/search.cy.js

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import { Editor } from '@tiptap/core'
77
import { Document } from '@tiptap/extension-document'
88
import { Text } from '@tiptap/extension-text'
99
import Search from '../../../src/extensions/Search.js'
10-
import Paragraph from '../../../src/nodes/Paragraph.js'
1110
import HardBreak from '../../../src/nodes/HardBreak.js'
11+
import Paragraph from '../../../src/nodes/Paragraph.js'
1212

1313
describe('editor search highlighting', () => {
1414
let editor = null
@@ -27,7 +27,9 @@ describe('editor search highlighting', () => {
2727
const searchQuery = 'Lorem ipsum dolor sit amet'
2828
editor.commands.setSearchQuery(searchQuery)
2929

30-
const highlightedElements = document.querySelectorAll('span[data-text-el="search-decoration"]')
30+
const highlightedElements = document.querySelectorAll(
31+
'span[data-text-el="search-decoration"]',
32+
)
3133
expect(highlightedElements).to.have.lengthOf(1)
3234
verifyHighlights(highlightedElements, searchQuery)
3335
})
@@ -36,7 +38,9 @@ describe('editor search highlighting', () => {
3638
const searchQuery = 'quod'
3739
editor.commands.setSearchQuery(searchQuery)
3840

39-
const highlightedElements = document.querySelectorAll('span[data-text-el="search-decoration"]')
41+
const highlightedElements = document.querySelectorAll(
42+
'span[data-text-el="search-decoration"]',
43+
)
4044
expect(highlightedElements).to.have.lengthOf(3)
4145
verifyHighlights(highlightedElements, searchQuery)
4246
})
@@ -47,7 +51,9 @@ describe('editor search highlighting', () => {
4751

4852
// Highlight only first occurrence
4953
editor.commands.setSearchQuery(searchQuery, false)
50-
highlightedElements = document.querySelectorAll('span[data-text-el="search-decoration"]')
54+
highlightedElements = document.querySelectorAll(
55+
'span[data-text-el="search-decoration"]',
56+
)
5157

5258
expect(highlightedElements).to.have.lengthOf(1)
5359
verifyHighlights(highlightedElements, searchQuery)
@@ -57,26 +63,38 @@ describe('editor search highlighting', () => {
5763
const searchQuery = 'quod'
5864

5965
editor.commands.setSearchQuery(searchQuery, true)
60-
const allHighlightedElements = document.querySelectorAll('span[data-text-el="search-decoration"]')
66+
const allHighlightedElements = document.querySelectorAll(
67+
'span[data-text-el="search-decoration"]',
68+
)
6169

6270
editor.commands.nextMatch()
63-
const currentlyHighlightedElement = document.querySelectorAll('span[data-text-el="search-decoration"]')
71+
const currentlyHighlightedElement = document.querySelectorAll(
72+
'span[data-text-el="search-decoration"]',
73+
)
6474

6575
expect(currentlyHighlightedElement).to.have.lengthOf(1)
66-
expect(allHighlightedElements[1]).to.deep.equal(currentlyHighlightedElement[0])
76+
expect(allHighlightedElements[1]).to.deep.equal(
77+
currentlyHighlightedElement[0],
78+
)
6779
})
6880

6981
it('can move to previous occurrence', () => {
7082
const searchQuery = 'quod'
7183

7284
editor.commands.setSearchQuery(searchQuery, true)
73-
const allHighlightedElements = document.querySelectorAll('span[data-text-el="search-decoration"]')
85+
const allHighlightedElements = document.querySelectorAll(
86+
'span[data-text-el="search-decoration"]',
87+
)
7488

7589
editor.commands.previousMatch()
76-
const currentlyHighlightedElement = document.querySelectorAll('span[data-text-el="search-decoration"]')
90+
const currentlyHighlightedElement = document.querySelectorAll(
91+
'span[data-text-el="search-decoration"]',
92+
)
7793

7894
expect(currentlyHighlightedElement).to.have.lengthOf(1)
79-
expect(allHighlightedElements[0]).to.deep.equal(currentlyHighlightedElement[0])
95+
expect(allHighlightedElements[0]).to.deep.equal(
96+
currentlyHighlightedElement[0],
97+
)
8098
})
8199
})
82100

0 commit comments

Comments
 (0)