File tree Expand file tree Collapse file tree 4 files changed +47
-5
lines changed
Expand file tree Collapse file tree 4 files changed +47
-5
lines changed Original file line number Diff line number Diff line change @@ -26,10 +26,10 @@ Tool uses Editor.js pasted patterns handling and inserts iframe with embedded co
2626- [ Pinterest] ( https://www.pinterest.com ) - ` pinterest ` service
2727- [ GitHub Gist] ( https://gist.github.com ) - ` github ` service
2828- [ Reddit] ( https://www.reddit.com/ ) - ` reddit ` service
29+ - [ Figma] ( https://www.figma.com/ ) - ` figma ` service
30+ - [ Whimsical] ( https://whimsical.com/ ) - whimsical service
2931- 👇 Any other [ customized service] ( #add-more-services )
3032
31-
32-
3333## Installation
3434
3535Get the package
@@ -152,6 +152,7 @@ var editor = EditorJS({
152152```
153153
154154#### Inline Toolbar
155+
155156Editor.js provides useful inline toolbar. You can allow it\` s usage in the Embed Tool caption by providing ` inlineToolbar: true ` .
156157
157158``` javascript
@@ -181,7 +182,6 @@ var editor = EditorJS({
181182| height | ` number ` | embedded content height
182183| caption | ` string ` | content caption
183184
184-
185185``` json
186186{
187187 "type" : " embed" ,
Original file line number Diff line number Diff line change 11{
22 "name" : " @editorjs/embed" ,
3- "version" : " 2.7.7 " ,
3+ "version" : " 2.8.0 " ,
44 "keywords" : [
55 " codex editor" ,
66 " embed" ,
Original file line number Diff line number Diff line change @@ -140,7 +140,6 @@ const SERVICES: ServicesConfigType = {
140140 id : ( ids ) => ids . join ( '/embed/' ) ,
141141 } ,
142142 instagram : {
143- //it support both reel and post
144143 regex : / ^ h t t p s : \/ \/ (?: w w w \. ) ? i n s t a g r a m \. c o m \/ (?: r e e l | p ) \/ ( .* ) / ,
145144 embedUrl : 'https://www.instagram.com/p/<%= remote_id %>/embed' ,
146145 html : '<iframe width="400" height="505" style="margin: 0 auto;" frameborder="0" scrolling="no" allowtransparency="true"></iframe>' ,
@@ -205,6 +204,21 @@ const SERVICES: ServicesConfigType = {
205204 width : 600 ,
206205 id : ( groups ) => `${ groups . join ( '/' ) } .js` ,
207206 } ,
207+ whimsical : {
208+ regex : / ( h t t p s : \/ \/ ) ? w h i m s i c a l .c o m \/ (?: [ a - z A - Z 0 - 9 \- ] + \- ) ? ( [ a - k m - z A - H J - N P - Z 1 - 9 ] { 16 , 22 } ) ( @ [ a - k m - z A - H J - N P - Z 1 - 9 ] + ) ? / ,
209+ embedUrl : 'https://whimsical.com/embed/<%= remote_id %>' ,
210+ html : "<iframe height='300' scrolling='no' frameborder='no' allowtransparency='true' allowfullscreen='true' style='width: 100%;'></iframe>" ,
211+ height : 300 ,
212+ width : 600 ,
213+ id : ( ids ) => ids [ 1 ]
214+ } ,
215+ figma :{
216+ regex : / ( h t t p s : \/ \/ w w w \. f i g m a \. c o m \/ .* ) ? / ,
217+ embedUrl : 'https://www.figma.com/embed?embed_host=share&url=<%= remote_id %>' ,
218+ html : "<iframe height='450' scrolling='no' frameborder='no' allowtransparency='true' allowfullscreen='true' style='width: 100%;'></iframe>" ,
219+ height : 300 ,
220+ width : 600
221+ } ,
208222} ;
209223
210224export default SERVICES ;
Original file line number Diff line number Diff line change @@ -612,3 +612,31 @@ describe('Miro service', () => {
612612 expect ( embed . data . source ) . to . be . equal ( regularBoardUrl ) ;
613613 } ) ;
614614} ) ;
615+
616+ describe ( 'whimsical' , ( ) => {
617+ it ( 'should correctly parse URL got from a browser' , ( ) => {
618+ const regularBoardUrl = 'https://whimsical.com/test-86ajy7vWEzYATvwFFvbwfA' ;
619+ const event = composePasteEventMock ( 'pattern' , 'whimsical' , regularBoardUrl ) ;
620+
621+ embed . onPaste ( event ) ;
622+
623+ expect ( patterns . whimsical . test ( regularBoardUrl ) ) . to . be . true ;
624+ expect ( embed . data . service ) . to . be . equal ( 'whimsical' ) ;
625+ expect ( embed . data . embed ) . to . be . equal ( 'https://whimsical.com/embed/86ajy7vWEzYATvwFFvbwfA' ) ;
626+ expect ( embed . data . source ) . to . be . equal ( regularBoardUrl ) ;
627+ } ) ;
628+ } ) ;
629+
630+ describe ( 'figma' , ( ) => {
631+ it ( 'should correctly parse URL got from a browser' , ( ) => {
632+ const regularBoardUrl = 'https://www.figma.com/file/3BYrViWFPvfhbrpm1aO3ha/Untitled?type=design&node-id=0%3A1&mode=design&t=WutMRT9L8VJNEL5z-1' ;
633+ const event = composePasteEventMock ( 'pattern' , 'figma' , regularBoardUrl ) ;
634+
635+ embed . onPaste ( event ) ;
636+
637+ expect ( patterns . figma . test ( regularBoardUrl ) ) . to . be . true ;
638+ expect ( embed . data . service ) . to . be . equal ( 'figma' ) ;
639+ expect ( embed . data . embed ) . to . be . equal ( 'https://www.figma.com/embed?embed_host=share&url=https://www.figma.com/file/3BYrViWFPvfhbrpm1aO3ha/Untitled?type=design&node-id=0%3A1&mode=design&t=WutMRT9L8VJNEL5z-1' ) ;
640+ expect ( embed . data . source ) . to . be . equal ( regularBoardUrl ) ;
641+ } ) ;
642+ } ) ;
You can’t perform that action at this time.
0 commit comments