Skip to content
This repository has been archived by the owner on Feb 9, 2021. It is now read-only.

How to remove image link from ep_previewimages? #12

Open
akshat-g opened this issue Apr 13, 2015 · 7 comments
Open

How to remove image link from ep_previewimages? #12

akshat-g opened this issue Apr 13, 2015 · 7 comments

Comments

@akshat-g
Copy link

When I use ep_previewimages, it also shows the image URL link below the image. I dont want the link on the etherpad instance.
How do I achieve this? I tried to modify domline.js in which It finally inserts the link but I ended up removing all the links from the etherpad instance.

@JohnMcLear
Copy link
Owner

Removing the link would stop the logic from working. So if you pasted an image link the image would not actually exist.. Think about it..... What behavior would you actually expect if you wanted to modify the image?

@akshat-g
Copy link
Author

I followed the exact steps used by file upload to upload and preview image through debugger.It takes the server link and sends it to 'replacerange' method of ace2_inner.js as text. Then it creates a changeset and applies it to the text of etherpad.
As far as I follow, the changeset which is formed contains a charbank which is actually server path of the Image. That server path is used to then create a src attribute for image. Also after this 'a' tag is added below image which contains the text of the image URL. Cannot that href link be removed from below the image? I tried that by removing 'a' tag in domline.js file.It somehow worked but was not satisfactory and I could not assure myself that changeset would be alright.

Actually I am writing a research paper using Etherpad that's why I dont want image link below the image.
Thanks

@JohnMcLear
Copy link
Owner

Yea it behaves similar to that.. If you remove the href from the image there will be no reference point for the URL so if someone wants to remove or change the link of the image it wont be possible.

Feel free to have a play and develop a better UX, I know it's doable but I just don't have the time right now.. I did the majority of this functionality in the ep_copy_paste_images plugin afaik.

@akshat-g
Copy link
Author

Ok thanks John. Can you please tell me what is the starting point of plugin - ep_copy_paste_images because I could not find it with the help of the debugger. Also if it would be alright if I merge some functionalities of ep_copy_paste (like resize) to ep_previewimages plugin?

I want to send one more parameter as args( args = {height:px,width:px} ) so that replacerange gets one more parameter.And this parameter later will be received by domline.js also where image src tag is being added. That will increase the functionality of ep_previewimages

@JohnMcLear
Copy link
Owner

I suggest you fork and / or create a new plugin.

I suggest reading the Etherpad docs on how to create plugins and also the hook docs.

Sadly I can't afford the time to hold your hand through this, you will need to do some digging of your own. Thankfully all of my plugins are open source so you can review their functionality and build from them :)

@akshat-g
Copy link
Author

ok. I am trying to figure a way out. Just one question though - In ep_previewimages plugin after the domline html is added, in the code , in undoModule this code comes -

function pushEvent(event)
{
var e = _.extend(
{}, event);
e.elementType = UNDOABLE_EVENT;
stackElements.push(e);
numUndoableEvents++;
//dmesg("pushEvent backset: "+event.backset);
}

in which e is an object with following properties ->

backset: "Z:1z<1p|1=8-1p$"
elementType: "undoableEvent"
eventType: "replaceRange"
selEnd: 69
selFocusAtStart: false
selStart: 69

And later
numUndoableEvents++;

Can you please tell me what is elementType in this?(elementType="undoableEvent")? and why is this added?

@JohnMcLear
Copy link
Owner

I'd have to look it up to find out, same as you :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants