📑 Collaborative document editing using Markdown
Перейти к файлу
Julius Härtl 08a9a055b6
Merge pull request #4553 from nextcloud/bugfix/noid/unique-index-name
2023-07-20 07:35:29 +02:00
.github chore: Update markdown issue template 2023-07-11 18:46:24 +02:00
.tx [tx-robot] Update transifex configuration 2022-10-01 03:02:12 +00:00
appinfo chore: Annotate controller methods in routes.php 2023-06-23 16:22:44 +02:00
composer fix: Add index to session_id on text_steps table 2023-07-14 11:25:20 +02:00
cypress ci: Fix cypress test failing due to new autofocus cursor position 2023-07-19 14:58:46 +02:00
img Fix notification icon color 2022-11-22 00:03:39 +01:00
js chore(assets): Recompile assets 2023-07-17 17:00:10 +00:00
l10n Fix(l10n): Update translations from Transifex 2023-07-20 01:40:13 +00:00
lib fix(postgres): Use a unique index name 2023-07-20 00:30:42 +02:00
src fix: Remember cursor position when autofocus on load 2023-07-17 13:19:56 +02:00
templates Do not attempt to load a non-existing script 2022-10-12 10:20:39 +02:00
tests fix: Delete inactive sessions in one query 2023-06-29 08:48:55 +02:00
.eslintignore 🔧 (#2462): small script adjusts 2022-05-31 16:16:24 -03:00
.eslintrc.js (#2184): add eslint-plugin-cypress 2022-03-14 11:38:29 -03:00
.gitattributes Add gitattributes 2019-08-06 10:42:47 +02:00
.gitignore chore: update relativeci workflow and webpack usage 2023-06-28 10:44:36 +02:00
.l10nignore Add translations for menu bar and ignore js folder 2019-07-17 16:40:03 +02:00
.php-cs-fixer.dist.php perf: Add authorative autoloader 2023-01-13 22:28:50 +01:00
.stylelintrc.js fix stylelint config and one css import 2021-12-30 12:11:55 +01: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 perf: Add authorative autoloader 2023-01-13 22:28:50 +01:00
README.md Minor adjustments to README.md 2023-02-01 21:27:10 +01:00
babel.config.js Fix chunk generation 2021-07-14 14:54:44 +02:00
composer.json chore(CI): Update master php testing versions and workflow templates 2023-01-16 15:16:17 +01:00
composer.lock chore(deps-dev): Bump phpunit/phpunit from 9.6.9 to 9.6.10 2023-07-15 01:05:09 +00:00
cypress.config.js cypress: Use createUser and login from @nextcloud/cypress 2022-11-30 11:30:53 +01:00
index.html Load Nextcloud server css files remotely from Github in index.html 2022-09-20 17:25:48 +02:00
jest-raw-loader.js ⬆️ Upgrade dependencies 2022-07-22 08:57:07 -03:00
jsconfig.json 🔧 (#2462): small script adjusts 2022-05-31 16:16:24 -03:00
krankerl.toml Prepare first release 2019-06-27 09:27:16 +02:00
package-lock.json chore(deps-dev): Bump word-wrap from 1.2.3 to 1.2.4 2023-07-19 13:54:26 +00:00
package.json fix(deps): update dependency @hocuspocus/provider to ^2.2.3 2023-07-17 08:52:04 +02:00
psalm.xml chore(deps-dev): Bump nextcloud/coding-standard from 1.1.0 to 1.1.1 2023-06-19 23:37:24 +02:00
renovate.json Update renovate.json 2023-07-13 08:43:59 +02:00
vite.config.js use @nextcloud/vue 7.8.0 2023-03-02 16:00:40 +01:00
webpack.config.js chore: update relativeci workflow and webpack usage 2023-06-28 10:44:36 +02: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

Currently, this app requires the main branch of the Viewer app.

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