Opened 3 years ago

Closed 3 years ago

#13519 closed New Feature (fixed)

Response should be more flexible

Reported by: Piotr Jasiun Owned by: Tomasz Jakut
Priority: Normal Milestone: CKEditor 4.6.0
Component: General Version: 4.5.0
Keywords: Cc:

Description (last modified by Piotr Jasiun)

Additional parameters in the response should be handled. Default fileUploadResponse handler should pass all additional JSON data to the data. So for example response with height and width parameters:

{
    "uploaded": 1,
    "fileName": "foo.jpg",
    "url": "/files/foo.jpg",
    "height: 90,
    "width": 160
}

Should set evt.data.width = 160 and evt.data.height = 90.

Change History (8)

comment:1 Changed 3 years ago by Piotr Jasiun

Summary: Response should be more flexible.Response should be more flexible

comment:2 Changed 3 years ago by Piotr Jasiun

Description: modified (diff)

comment:3 Changed 3 years ago by Piotr Jasiun

Description: modified (diff)

comment:4 Changed 3 years ago by Jakub Ś

Status: newconfirmed

comment:5 Changed 3 years ago by Piotrek Koszuliński

Milestone: CKEditor 4.6.0
Version: 4.5.0

comment:6 Changed 3 years ago by Tomasz Jakut

Owner: set to Tomasz Jakut
Status: confirmedassigned

comment:7 Changed 3 years ago by Tomasz Jakut

Status: assignedreview

I don't really know if my solution is elegant enough, but I noticed that the response parsed by default fileUploadResponse handler is passed back to the FileLoader instance and widgets have access only to it (via onUploaded callback) - so I thought that the response could be also attached to the FileLoader - and response property sounds most sane to me.

So widgets can get additional data from response using something like this:

onUploaded: function( loader ) {
	this.replaceWith( '<img width="' + loader.response.width + '">' );
}

The current version is in branch:t/13519

Last edited 3 years ago by Tomasz Jakut (previous) (diff)

comment:8 Changed 3 years ago by Piotr Jasiun

Resolution: fixed
Status: reviewclosed

I pushed some additional commits and closed this thicket.

git:1f04c2c

Note: See TracTickets for help on using tickets.
© 2003 – 2017 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy