Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

package: expose ImageResolver so it can be provided to RichTextReader #2514

Merged
merged 2 commits into from
Jul 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
24 changes: 20 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,25 @@
</head>
<body>
<div id="app"></div>
<script>
OC = { webroot: '/OC_WEBROOT' }
</script>
<script type="module">
import { RichTextReader } from './src/package.js'
import { RichTextReader, ImageResolver, IMAGE_RESOLVER } from './src/package.js'
import Vue from 'vue'
import content from './src/tests/fixtures/basic.md?raw'
const app = new Vue({
data() {
return {
content: '**Hello There**',
content
}
},
provide: {
currentDirectory: '/'
provide() {
const val = {}
Object.defineProperties(val, {
[IMAGE_RESOLVER]: { get: () => this.$imageResolver },
})
return val
},
render: (h) => h('div', [
h('textarea', {
Expand All @@ -38,6 +46,14 @@
props: { content: app.content }
}),
]),
created() {
this.$imageResolver = new ImageResolver({
currentDirectory: '/dir/',
shareToken: 'SHARE_TOKEN',
user: { uid: 'USER_UID' },
fileId: '4173',
})
},
})
app.$mount('#app')
</script>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@nextcloud/text",
"description": "Collaborative document editing",
"version": "25.0.0-alpha.5",
"version": "25.0.0-alpha.7",
"authors": [
{
"name": "Julius Härtl",
Expand Down
4 changes: 3 additions & 1 deletion src/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,7 @@
*/

import RichTextReader from './components/RichTextReader.vue'
import ImageResolver from './services/ImageResolver.js'
import { IMAGE_RESOLVER } from './components/EditorWrapper.provider.js'

export { RichTextReader }
export { RichTextReader, ImageResolver, IMAGE_RESOLVER }
11 changes: 11 additions & 0 deletions src/tests/fixtures/basic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
**Hello There**

# Heading

[link](href)
![image](src.png)


|table| heading| row|
| --- | --- | --- |
|first| body| row|