tuankhac / share-extras

Automatically exported from code.google.com/p/share-extras
0 stars 0 forks source link

Wiki Rich Content: Can't get embedded document previews to work in 4.2.c #123

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
0. Install the Wiki Rich Content jar from Share Extras
1. Create a site, upload documents, create a wiki page, edit it
2. Use the TinyMCE icon to "Insert Document Link"
3. Click on the link.
4. Use the TinyMCE icon to "Insert/Edit Link" and select one of the "embed" 
targets.
5. Save the page.

What is the expected output? What do you see instead?
Wiki Rich Content should recognize the link and insert an embedded document 
preview. Instead it just displays the link with no preview.

What version of the add-on are you using? Please provide version of the
downloaded package, or Subversion revision number.
I tested wiki-rich-content-2.1.jar and SVN 1363

What version of Alfresco are you using? On what application server?
4.2.c using the standard installer (tomcat) running on Linux Mint Debian 
Edition Wheezy (pre-release)

What web browser are you using? Please supply browser name and version.
Firefox 17.0 and Chrome Version 23.0.1271.97

Please provide any additional information below.
It appears that the way Document Link URLs are encoded in the wiki changed in 
4.2.c. I think this is preventing the links from being recognized.

Original issue reported on code.google.com by espl...@gmail.com on 8 Jan 2013 at 5:35

GoogleCodeExporter commented 8 years ago
share-extras-read-only/Wiki Rich 
Content/source/web/extras/components/wiki/document-parser.js line 113 is 
appears to look for a non-URL encoded link.

docRe = new 
RegExp("\\/document-details\\/?\\?nodeRef=(\\w+:\\/\\/\\w+\\/[-\\w]+)"),

My links appear to be URL Encoded link this:

<p><a 
href="document-details?nodeRef=workspace%3A%2F%2FSpacesStore%2F557b52d8-9034-410
b-9adf-a300b1f643bd" target="embed">This is a document link</a></p>

Original comment by espl...@gmail.com on 8 Jan 2013 at 5:36

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Using this regular expresson on line 113 of document-parser.js has the link 
recognized by the Wiki Rich Content plugin (the embed with no link target 
removes the link).

docRe = new RegExp("document-details\\/?\\?nodeRef=(\\w+%3A%2F%2F\\w+  
%2F[-\\w]+)"),

But I think the URL needs to be decoded on line 265 in order for the preview to 
work and I haven't figured out how to do that in JavaScript yet.

Original comment by espl...@gmail.com on 8 Jan 2013 at 5:54

GoogleCodeExporter commented 8 years ago

Original comment by will.abson on 11 Feb 2013 at 12:53

GoogleCodeExporter commented 8 years ago
Fixed in trunk on GitHub

Original comment by will.abson on 12 Mar 2013 at 2:51