📑 Collaborative document editing using Markdown
Перейти к файлу
nextcloud-command f6ad0ba466 fix(deps): Fix npm audit
Signed-off-by: GitHub <noreply@github.com>
2024-12-08 03:50:09 +00:00
.github ci: Run cypress on ubuntu-latest 2024-11-26 22:55:34 +00:00
.reuse ci: Fix dep5 for css files 2024-07-18 14:01:58 +02:00
.tx [tx-robot] Update transifex configuration 2022-10-01 03:02:12 +00:00
LICENSES chore: Add SPDX headers 2024-06-14 11:56:34 +02:00
appinfo chore: Add SPDX headers 2024-06-14 11:56:34 +02:00
composer feat(db): Add timestamp field to steps database 2024-06-12 14:48:22 +02:00
css chore(assets): recompile assets 2024-11-27 13:37:31 +00:00
cypress Merge pull request #6697 from nextcloud/backport/6650/stable30 2024-11-27 14:36:03 +01:00
img chore: Add SPDX headers 2024-06-14 11:56:34 +02:00
js chore(assets): recompile assets 2024-12-08 02:20:04 +00:00
l10n Fix(l10n): Update translations from Transifex 2024-12-08 02:18:21 +00:00
lib Merge pull request #6697 from nextcloud/backport/6650/stable30 2024-11-27 14:36:03 +01:00
src Merge pull request #6697 from nextcloud/backport/6650/stable30 2024-11-27 14:36:03 +01:00
templates chore: Add SPDX headers 2024-06-14 11:56:34 +02:00
tests chore(dev-deps): Bump nextcloud/ocp package 2024-08-06 19:59:58 +02:00
.eslintignore chore: Add SPDX headers 2024-06-14 11:56:34 +02:00
.eslintrc.cjs fix: Correctly set "new"-menu entry for folder description 2024-09-04 09:24:03 +00:00
.gitattributes Add gitattributes 2019-08-06 10:42:47 +02:00
.gitignore test(cypress): Add test to visually compare print view 2023-11-29 17:08:39 +01:00
.l10nignore Add translations for menu bar and ignore js folder 2019-07-17 16:40:03 +02:00
.nextcloudignore chore: Update krankerl config 2023-12-27 10:26:42 +01:00
.php-cs-fixer.dist.php perf: Add authorative autoloader 2023-01-13 22:28:50 +01:00
.stylelintrc.cjs chore: Add SPDX headers 2024-06-14 11:56:34 +02:00
.tsconfig.json feat: Move to vite for bundling 2024-05-15 09:54:15 +02:00
AUTHORS chore: Add SPDX headers 2024-06-14 11:56:34 +02:00
CHANGELOG.md Prepare release of 1.0.2 2019-08-08 10:16:01 +02:00
COPYING Add basic app structure 2019-03-18 17:15:31 +01:00
Makefile chore: Add SPDX headers 2024-06-14 11:56:34 +02:00
README.md Added use statement for LoadEditor class 2024-06-18 12:46:17 +02:00
babel.config.cjs chore: Add SPDX headers 2024-06-14 11:56:34 +02:00
composer.json chore(CI): Adjust testing matrix for Nextcloud 30 on stable30 2024-08-14 14:02:49 +02:00
composer.lock chore(dev-deps): Bump nextcloud/ocp package 2024-10-30 15:31:59 +01:00
cypress.config.mjs test(ci): Fix path of visual regression base files 2024-09-14 21:49:42 +02:00
jest-raw-loader.cjs chore: Add SPDX headers 2024-06-14 11:56:34 +02:00
jsconfig.json 🔧 (#2462): small script adjusts 2022-05-31 16:16:24 -03:00
krankerl.toml chore: Update krankerl config 2023-12-27 10:26:42 +01:00
package-lock.json fix(deps): Fix npm audit 2024-12-08 03:50:09 +00:00
package.json fix(deps): update dependency lib0 to ^0.2.99 2024-12-08 01:12:44 +00:00
psalm.xml chore(psalm): Add assistant event to stub 2023-08-09 18:15:00 +02:00
renovate.json deps(renovate): No longer open PRs for dependency updates on stable27 2024-07-24 16:45:20 +02:00
tsconfig.json fix(sync): inline y-websocket to track received updates there 2024-11-26 14:47:10 +00:00
vite.config.ts chore(deps): update dependency rollup-plugin-webpack-stats to v1 2024-08-06 09:23:04 +02:00

README.md

Nextcloud Text

REUSE status 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.

use OCA\Text\Event\LoadEditor;

// ...

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()
})