Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
61d6f8d
enh(editor): Wrap editor into a frontend API
juliusknorr Dec 29, 2022
8c6cd4d
enh(editor): Allow to setContent on the editor
juliusknorr Dec 29, 2022
988f99c
enh(Editor): Emit event on update
juliusknorr Dec 29, 2022
580bcf4
enh: Add event to load editor
juliusknorr Dec 29, 2022
2ee8534
fix(editor): Avoid errors when no parent component is present
juliusknorr Dec 29, 2022
dcaf534
feat: Add MarkdownContentEditor component
juliusknorr Dec 30, 2022
e914638
refactor: Make Wrapper component easier to reuse with default prop va…
juliusknorr Dec 30, 2022
d9ab846
refactor: Unify editor plugins for rich text editing in the RichText …
juliusknorr Dec 30, 2022
0c6345c
refactor: Allow to pass custom items/emit to mentions plugin
juliusknorr Dec 30, 2022
eb65c5f
chore: load script for direct editing outside of template
juliusknorr Dec 30, 2022
ccd5049
fix: Add fallback values for reading editors relative path
juliusknorr Dec 30, 2022
21adb2d
fix: Keep RichTextReader with previous extension set
juliusknorr Dec 30, 2022
ac03f67
chore: Update composer autoloader
juliusknorr Jan 19, 2023
e257f3d
fix(Wrapper): Avoid absolute positioning
juliusknorr Jan 27, 2023
160d64e
feat: Migrate to class based editor api and hook attachment/link/imag…
juliusknorr Jan 28, 2023
9a60337
fix: Only open image viewer on click to the actual image
juliusknorr Jan 28, 2023
78ee556
fix: Only render link previews if links start with http(s)
juliusknorr Jan 28, 2023
1d7cc11
fix: Move scroll container definition outside of core text components
juliusknorr Jan 28, 2023
e5b881d
docs: Add notes about the component integration to the readme
juliusknorr Jan 28, 2023
b78766b
fix: Implement onLoaded callback
juliusknorr Jan 28, 2023
1b76d99
fix: Set content for file editor
juliusknorr Feb 1, 2023
2da1f89
fix: Missing history plugin
juliusknorr Feb 1, 2023
9bc0880
fix(Menubar): Avoid negative offset on small screens
juliusknorr Jan 27, 2023
47b58c9
Expose focus command from createEditor
mejo- Feb 1, 2023
a0f9aa6
Fix imports and set webpackChunkName for async imports
mejo- Feb 1, 2023
4591c69
fix(MenuBar): Only preserve 100px for the right section
juliusknorr Feb 1, 2023
361a9d9
fix: Work around issue where numeric value is passed to prosemirror-m…
juliusknorr Feb 1, 2023
32f2cf8
Minor adjustments to README.md
mejo- Feb 1, 2023
49a898f
Compile assets
nextcloud-command Feb 1, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
docs: Add notes about the component integration to the readme
Signed-off-by: Julius Härtl <[email protected]>
  • Loading branch information
juliusknorr committed Feb 1, 2023
commit e5b881dc48bc551d50818eeed47b4a2593acbcf3
53 changes: 53 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,56 @@ Or you might set the `CYPRESS_baseUrl` environment variable for a custom nextclo
- The mime type needs to be known by Nextcloud server (see https://github.com/nextcloud/server/pull/24488 for how this can be added)
- 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
- You can test them like other mime types in cypress/e2e/files.spec.js


## 🛠️ Integrate text in your app

## Load the editor

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

```php
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. You will need to provide an editor fallback on your own in this case.


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