Skip to content

Commit

Permalink
feat: support image to preview
Browse files Browse the repository at this point in the history
  • Loading branch information
whyour committed Sep 27, 2019
1 parent a7035fc commit 6c7f937
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 16 deletions.
2 changes: 1 addition & 1 deletion dist/quill.bubble.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Quill Editor v2.0.10
* Quill Editor v2.0.12
* https://quilljs.com/
* Copyright (c) 2014, Jason Chen
* Copyright (c) 2013, salesforce.com
Expand Down
2 changes: 1 addition & 1 deletion dist/quill.core.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Quill Editor v2.0.10
* Quill Editor v2.0.12
* https://quilljs.com/
* Copyright (c) 2014, Jason Chen
* Copyright (c) 2013, salesforce.com
Expand Down
4 changes: 2 additions & 2 deletions dist/quill.core.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/quill.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/quill.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/quill.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/quill.snow.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Quill Editor v2.0.10
* Quill Editor v2.0.12
* https://quilljs.com/
* Copyright (c) 2014, Jason Chen
* Copyright (c) 2013, salesforce.com
Expand Down
6 changes: 3 additions & 3 deletions dist/unit.js

Large diffs are not rendered by default.

16 changes: 15 additions & 1 deletion formats/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,24 @@ const ATTRIBUTES = ['alt', 'height', 'width'];
class Image extends EmbedBlot {
static create(value) {
const node = super.create(value);
const span = document.createElement('span');
if (typeof value === 'string') {
node.setAttribute('src', this.sanitize(value));
span.setAttribute('href', this.sanitize(value));
span.setAttribute('data-fancybox-href', this.sanitize(value.origin));
}
return node;
if (value.thumb) {
node.setAttribute('src', this.sanitize(value.thumb));
}
if (value.origin) {
span.setAttribute('href', this.sanitize(value.origin));
span.setAttribute('data-fancybox-href', this.sanitize(value.origin));
}
span.setAttribute('data-fancybox-type', 'image');
span.setAttribute('data-fancybox-group', 'editor');
span.classList.add('fancybox');
span.appendChild(node);
return span;
}

static formats(domNode) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "quill",
"version": "2.0.11",
"version": "2.0.12",
"description": "Your powerful, rich text editor",
"author": "Jason Chen <[email protected]>",
"homepage": "http://quilljs.com",
Expand Down

0 comments on commit 6c7f937

Please sign in to comment.