Thanks Eduard for your reply.

I have created a JavaScript extension and added jquery code that will give me 
highlighted text value. Please find attached screenshot of the same.

But this extension is working only in edit mode.
Could you please suggest what might be the issue?


Thanks & Regards,
Abdulkadar Patel


-----Original Message-----
From: devs [mailto:[email protected]] On Behalf Of Eduard Moraru
Sent: Tuesday, September 15, 2015 8:20 PM
To: XWiki Developers
Subject: Re: [xwiki-devs] text highlighting event

Hi,

Well, the Annotations application does not use any built in functionality of 
XWiki. It simply uses javascript on the HTML output.

Have you read the Skin Extensions tutorial [1] on how to plug in your 
JavaScript/CSS in XWiki?

In other words, if you want to do something like what you`ve described, there 
is no XWiki default feature for it, since there was no current usecase to 
justify it. The only way to achieve it, at the moment, is to develop it 
yourself using a JSX (JavaScript Extension). Sure, you could also make it in a 
.js file in the webapp's resources folder or in inside a webjar [2], but the 
JSX is the cleanest and the recommended way to go.

Thanks,
Eduard

----------
[1] http://platform.xwiki.org/xwiki/bin/view/DevGuide/SkinExtensionsTutorial
[2] http://extensions.xwiki.org/xwiki/bin/view/Extension/WebJars+Integration

On Tue, Sep 15, 2015 at 5:34 PM, PATEL, ABDULKADAR < 
[email protected]> wrote:

> Dear Eduard,
>
> I know this basic jquery functionality and I can develop this in a 
> standalone application.
> The reason I am asking this query to XWIKI developers is because I 
> want to achieve this in XWIKI. :) So my question to be clear here is :
> Whether we can achieve this using in built functionalities of xwiki 
> like done in add annotation functionality or I have to develop it from 
> scratch like any other web app.
>
> I hope you now understand my question.
>
>
> Thanks & Regards,
> Abdulkadar Patel
>
> P.S. : Don't worry, I will not get discouraged but try to learn from 
> everything :)
>
>
> -----Original Message-----
> From: devs [mailto:[email protected]] On Behalf Of Eduard Moraru
> Sent: Tuesday, September 15, 2015 7:53 PM
> To: XWiki Developers
> Subject: Re: [xwiki-devs] text highlighting event
>
> Hi,
>
> Again, this is not an XWiki related question, but a generic JavaScript 
> (web development actually) question on wich there are many articles, 
> tutorials and forum/stackoverflow answers.
>
> As a quick reply, here's a small javascript that alerts the selected
> message:
>
> jQuery(document).on('mouseup', function (event) {
>   var selection = "";
>   if (window.getSelection) {
>     selection = window.getSelection().toString();
>   } else if (document.selection && document.selection.type != "Control") {
>     selection = document.selection.createRange().text;
>   }
>
>   alert('Selected: ' + selection);
> });
>
> Got that from a quick Google search, which you could do as well if you 
> first spend a bit of time in understanding the basics of web development.
>
> If you want to customize or develop from scratch (i.e. not using
> AppWithinMinutes) XWiki applications, you really need to know at least 
> the basics on web development (HTML, JavaScript, CSS).
>
> Hope this helps,
> Eduard
>
> P.S.: Don`t want to discourage you or anything, just hope to guide you 
> in the right direction :)
>
> On Mon, Sep 14, 2015 at 3:52 PM, PATEL, ABDULKADAR < 
> [email protected]> wrote:
>
> > Hi all,
> >
> > Is there a way to handle text highlight event in xwiki?
> > In annotation component, when we highlight some text and then press
> > ctrl+M, Annotations popup is displayed.
> > How is this achieved?
> > I want to display a popup when user highlights some text on an xwiki
> page.
> > The popup will have a text box which will be pre-populated with the 
> > highlighted text.
> > Please suggest me a proper approach to achieve this.
> >
> > Thanks in advance.
> >
> >
> > Thanks & Regards,
> > ____________________________________________________________________
> > [cid:[email protected]]Abdulkadar Patel Consultant | 
> > GESBU
> >
> > Capgemini India | Pune
> > Tel.: +91 20 6631 1755 - Extn: 20 12530
> > Mob.: + 91 8087683419
> > Email:  [email protected]<mailto:
> > [email protected]>
> > www.capgemini.com<http://www.capgemini.com/>
> > People matter, results count.
> > ____________________________________________________________________
> > __
> > _
> > 7 Switch off as you go |q Recycle always | P Print only if 
> > absolutely necessary
> >
> >
> > _______________________________________________
> > devs mailing list
> > [email protected]
> > http://lists.xwiki.org/mailman/listinfo/devs
> >
> >
> _______________________________________________
> devs mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/devs
> _______________________________________________
> devs mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/devs
>
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs
This message contains information that may be privileged or confidential and is 
the property of the Capgemini Group. It is intended only for the person to whom 
it is addressed. If you are not the intended recipient, you are not authorized 
to read, print, retain, copy, disseminate, distribute, or use this message or 
any part thereof. If you receive this message in error, please notify the 
sender immediately and delete all copies of this message.
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to