Skip to content

Commit 8626e6c

Browse files
committed
fix(upload): upload function passed as params
1 parent 01afb7e commit 8626e6c

File tree

5 files changed

+14648
-9
lines changed

5 files changed

+14648
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@owliehq/editor",
3-
"version": "1.0.0",
3+
"version": "1.1.0",
44
"description": "A modern WYSIWYG rich-text editor built on top of tiptap and Quasar for Vue.js",
55
"productName": "Owlie Quasar Tiptap editor",
66
"scripts": {

src/components/QuasarTiptap.vue

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ import {
9898
OKatexInline,
9999
OFormatClear,
100100
OPrint,
101-
OImage,
101+
//OImage,
102102
OEmbed,
103103
RecommendedExtensions,
104104
OwlieImageDrag
@@ -180,6 +180,12 @@ export default {
180180
default: function () {
181181
return {}
182182
}
183+
},
184+
uploadCallback: {
185+
type: Function,
186+
default: function () {
187+
return ''
188+
}
183189
}
184190
},
185191
components: {
@@ -280,15 +286,14 @@ export default {
280286
extension = new DynamicClass('OLink')
281287
break
282288
case 'OwlieImageDrag':
283-
const uploadFunction = () => {
284-
return 'http://placehold.it/900x350'
285-
}
289+
console.log(this.uploadCallback)
286290
287-
extension = new OwlieImageDrag({ uploadFunction })
291+
extension = new OwlieImageDrag({ uploadFunction: this.uploadCallback })
288292
default:
289293
try {
290294
extension = new DynamicClass(extension)
291295
} catch (e) {
296+
//console.log(extention)
292297
console.error(e.message)
293298
}
294299
break

src/extentions/ImageDrag.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,6 @@ export default class ImageDrag extends Node {
121121
/image/i.test(file.type)
122122
)
123123

124-
console.log('images', images)
125-
126124
if (images.length === 0) {
127125
return
128126
}

src/pages/examples/basic.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ export default {
2121
editable: true,
2222
showToolbar: true,
2323
showBubble: true,
24+
async uploadCallback() {
25+
return 'http://placehold.it/900x350'
26+
},
2427
extensions: [
2528
// TipTap
2629
'Bold',
@@ -146,7 +149,7 @@ export default {
146149
onUpdate({ state, getJSON, getHTML }) {
147150
this.json = getJSON()
148151
this.html = getHTML()
149-
console.log('html', this.html)
152+
//console.log('html', this.html)
150153
151154
// console.log('json', JSON.stringify(this.json))
152155
}

0 commit comments

Comments
 (0)