📑 Collaborative document editing using Markdown
Перейти к файлу
github-actions[bot] 0030b86368
Merge pull request #5669 from nextcloud/renovate/main-nextcloud-dialogs-5.x
fix(deps): update dependency @nextcloud/dialogs to ^5.3.0 (main)
2024-04-13 05:05:40 +00:00
.github Merge pull request #5607 from relative-ci/main 2024-04-05 09:10:26 +02:00
.tx
appinfo feat(deps): Add Nextcloud 30 support on main 2024-03-28 12:57:51 +01:00
composer fix(Middleware): Response with 412 if `baseVersionEtag` doesn't match 2024-03-20 15:27:29 +01:00
cypress Merge pull request #5238 from nextcloud/renovate/main-tiptap 2024-04-04 09:49:12 +00:00
img feat: Add icon svg inline for New text file 2024-03-21 20:23:06 +01:00
js chore(assets): recompile assets 2024-04-11 11:12:26 +00:00
l10n Fix(l10n): Update translations from Transifex 2024-04-11 01:41:52 +00:00
lib fix: Avoid throwing when a workspace file cannot be found due to a failed storage 2024-04-11 12:38:29 +01:00
src fix: improve node and mark copy-paste behavior 2024-04-11 11:06:25 +02:00
templates
tests fix(lint): avoid risky truthy falsy comparison 2024-04-04 10:04:16 +02:00
.eslintignore
.eslintrc.js
.gitattributes
.gitignore
.l10nignore
.nextcloudignore chore: Update krankerl config 2023-12-27 10:26:42 +01:00
.php-cs-fixer.dist.php
.stylelintrc.js
CHANGELOG.md
COPYING
Makefile
README.md
babel.config.js
composer.json
composer.lock chore(dev-deps): Bump nextcloud/ocp package 2024-04-07 02:40:11 +00:00
cypress.config.js test(cypress): Fix import from `cypress-visual-regression` 2024-02-26 14:40:25 +01:00
index.html fix(deps): update dependency @nextcloud/router to ^2.2.1 2024-01-31 08:24:53 +01:00
jest-raw-loader.js
jsconfig.json
krankerl.toml chore: Update krankerl config 2023-12-27 10:26:42 +01:00
package-lock.json Merge pull request #5669 from nextcloud/renovate/main-nextcloud-dialogs-5.x 2024-04-13 05:05:40 +00:00
package.json Merge pull request #5669 from nextcloud/renovate/main-nextcloud-dialogs-5.x 2024-04-13 05:05:40 +00:00
psalm.xml
renovate.json chore: Update renovate.json to match stable releases 2024-04-02 11:48:35 +02:00
sample.md enh(nodes): introduce preview node 2024-03-06 18:56:30 +01:00
tsconfig.json chore: Add typescript config 2024-02-13 16:56:12 +01:00
vite.config.js
webpack.config.js fix: Merge webpack splitChunks options 2023-11-29 20:27:04 +01:00

README.md

Nextcloud Text

GitHub Workflow Status Start contributing

📑 Collaborative document editing!

Features

  • 📝 Simple focused writing: No distractions, only the formatting you need.
  • 🙋 Work together: Share and collaborate with friends and colleagues, no matter if they use Nextcloud or not!
  • 💾 Open format: Files are saved as Markdown, so you can edit them from any other text app too.
  • Strong foundation: We use 🐈 tiptap which is based on 🦉 ProseMirror – huge thanks to them!

Nextcloud Text is the default text editor since Nextcloud 17. To start editing just open an existing markdown or plaintext file or create a new one.

Configuration

The rich workspaces in the file list can be disabled either by the users in the files app settings or globally by the admin with the following occ command:

occ config:app:set text workspace_available --value=0

🏗 Development setup

This app requires the main branch of the Viewer app to be installed and enabled. Follow its development setup and then continue here.

  1. ☁ Clone this app into the apps folder of your Nextcloud: git clone https://github.com/nextcloud/text.git
  2. 👩‍💻 In the folder of the app, run the command make to install dependencies and build the Javascript.
  3. Enable the app through the app management of your Nextcloud
  4. 🎉 Partytime! Help fix some issues and review pull requests 👍

🧙 Advanced development stuff

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.

🐞 Testing the app

Currently, this app uses three different kinds of tests:

For testing the backend (PHP) Psalm and PHPUnit are used, you can run the testcases (placed in tests/) using the composer scripts psalm and test:unit.

For testing the frontend jest is used for unittests, whereas cypress is used for end2end testing. The unittests are also placed in src/tests/, the cypress tests are placed in cypress/. You can run the tests using the package scripts npm run test (jest), and respective npm run test:cypress (cypress).

Please note the cypress tests require a nextcloud server running, the if no running server is detected a docker container will be started, this requires the current user to be in the docker group. Or you might set the CYPRESS_baseUrl environment variable for a custom nextcloud server.

Adding support for other mime types

🛠️ Integrate text in your app

Load the editor

In order to load the editor in your app, you'll need to dispatch an event.

if (class_exists(LoadEditor::class)) {
	$this->eventDispatcher->dispatchTyped(new LoadEditor());
}

Integrate a file editor

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.

window.OCA.Text.createEditor({
	el: document.getElementById('my-editor-div'),
	fileId: 12345,
	filePath: '/Readme.md',
}).then((editor) => {
	// Once ready you can access the editor instance and call methods like:

	editor.setContent('new content') // Beware: this will overwrite the content read from the source file
	editor.setReadOnly(true)
	editor.insertAtCursor('<h1>Heading</h1>')

	// Make sure to destory the editor instance once you remove the dom element
	editor.destroy()
})

Markdown based content editor

window.OCA.Text.createEditor({
	el: document.getElementById('my-editor-div'),
	content: 'initial content',
}).then((editor) => {
	// Once ready you can access the editor instance and call methods like:

	editor.setContent('new content')
	editor.setReadOnly(true)
	editor.insertAtCursor('<h1>Heading</h1>')

	// Make sure to destory the editor instance once you remove the dom element
	editor.destroy()
})