Insert links in jeditorpane

Hi,
I am working on an applet that allow a user to edit simple HTML.
The user can basicly enter plain text, and there are buttons that bold and add links.
I have also made Enter insert a break tag.
The code works fine EXCEPT in one case.
If a user pastes in some text, that has newlines in it, and selects the first word after a newline to become a link, the link appears on the line above where it should be.
The strange thing is that when I print the jeditorpane text, it looks fine, it just does not display in the pane correctly.
The code I use is
editor.replaceSelection("");
kit.insertHTML( doc, start, "<a href=\"" + link + "\">" + text + "</a>", 0, 0, HTML.Tag.A );
HOWEVER if I change to
kit.insertHTML( doc, start, "<a href=\"" + link + "\">" + text + "</a>", 1, 1, HTML.Tag.A );
I.e. change 0,0 to 1,1 it displays properly BUT only in the case where the word selected is just after a newline.
I catch Ctrl-V keypresses, to ensure that the user only pastes in the plaintext version of what they are pasting. The problem would be solved if I could replace the newlines with break tags at this stage, but if I do that, the tags appear in the text.
So (finally) my questions are.
a) Is there a way to see check for the newline character being before the word selected?
b) Or is there a way to make the default pasteaction handle break tags as markup rather than plain characters.
Thanks
wbxv

a) Is there a way to see check for the newline character being before the word selected?You can try something like this:
String newline=System.getProperty("line.separator");
if (text.startsWith(newline)) text=text.substring(newline.length());
editor.replaceSelection("");
kit.insertHTML( doc, start, "<a href=\"" + link + "\">" + text + "</a>", 0, 0, HTML.Tag.A );
b) Or is there a way to make the default pasteaction handle break tags as markup rather than plain
characters.You can try something like this:
int i=text_to_paste.indexOf(newline);   // newline is defined above
if (i>=0) text_to_paste=text_to_paste.substring(0,i)+"<br>"+text_to_paste.substring(i+newline.length());You can make a loop to replace all newlines with <br> if you like.
Hope this helps...
V.V.

Similar Messages

  • How to insert links in an Acrobat 8 pdf document to open folders

    I am using Acrobat 8 and have made a "menu" page in InDesign which will has links in it to open other pdf documents. I have successfully exported to PDF from InDesign and inserted links to my PDF files which work perfectly. I now need to insert a link to direct the user to a particular folder so they can view the files/folders within that folder.
    The complete set of documents will be burnt onto DVD and the "menu" pdf will open using an autorun file.
    How can I insert a link in the PDF document that will open the folder that I want the reader to be able to view and navigate through themselves.  Any suggestions would be very much appreciated as this is a major job for a client.  I have seen a few ideas on the net but nothing that really answers my particular question.
    Cheers - Claire

    what should have been done, is place all the PDF in Folder including your contents page and Make all your links in Indesign. Then burn the folder to the DVD. That way all the links would be relative to location of the files.
    Try a test that way. As was said Acrobat can't do it.

  • Insert Link and Insert Image broken in Chrome

    The Insert Link and Insert Image buttons have been broken in my Chrome for at least the last couple of days (latest version, 32.0.1700.72 m, Windows 7 64).  
    When you click one of the buttons, the overlay window appears with a title, but it is otherwise black with no contents.  (See screenshot below.)
    The buttons work fine in Firefox.  What hasn't helped: deleting cookies, clearing the browser cache, waiting for several minutes for their content to appear.

    Whtat are we supposed to Claudio? All descend on Adobe with  clubs and try to beat some sense into someone!
    The fact is the customer is no longer the prime concern. Most companies don't give a Rats behind (toned down to prevent censors action) about the customers. It's the almighty dollar. Screw as many customers as they can while they can and line their pockets with all the green backs  as they can while they can. Then if the cusomers leave so be they take their money and run.
    Customer use to have power, they would speak loud and frequently and get things  fixed. And what with people from other countries now owning US companies, That were brought up with different moral compasses. They have no concept of this thing of loyalty to customers. The customer can jump off a cliff and they will simply cheer them on while the do so.
    We have lost, the fight can't be won. It no use. So Pat and others are right.
    I've been trying for 15 years for adobe to fix the issue of having multiple Pdfs created from Office documents because the claim they can't figure out how MS does Page and section breaks. And the issue of Weblinks not being active when converted to PDF's Both on Mac's yet on PC's there is no issue. I quite this year after I received a down right nasty not from Adobe say they didn't have any interest in fixing the bugs and were not about to try. What it amounted was go take a flying leap.
    They have the ability. They have beenblaming Its apple because they don't do such and such , or Microsoft because they don't do so and such. On the Links issue Saying MS doesn't provided the necessary hooks in the mac version of Office. They do you can take a Word document created on a Mac and open a PC and create a PDF and the links will be active. You can Open a Word Document in Apple's pages and all links created in Office document will be there.  The argument has been proven several different ways to be a an outright bald-faced lie. The defect is squarely with the Mac version of Acrobat.
    So Pat and others are right. Just throw in that towel. Adobe support of its customers is now 10 times worse than intuit's which is supposed have the lowest reputation of any software compny that ever existed.

  • PDF form - outlook insert link not working

    I created PDF Form with button having js program (this.mailDoc()). Program is working, when click the button outlook mail open with PDF form as attachment. But In the MS outlook mail body, Insert Link is not working (I need to insert hyper-link in the same mail along with PDF Form as default attachment)
    Please guide to come out this.
    Thanks

    Hi vijayk,
    Which hyperlink you are taking about. Can you explain what actually you are trying to do.
    I am not able to understand what are you trying to achieve.
    Regards,
    Ajlan Huda.

  • How to I activate the "insert link" function which accepts a saved/pasted address for highlighted text in V31.0?

    It worked perfectly in prior versions, but now in this version 31.0, when I try to paste a saved URL as a link into highlighted text, it returns this error message: "(No named anchors or headings in this page)", and refuses to accept a paste. Note that this is broken both when clicking on the little blue screen icon as well as when selecting "insert/link" from the function bar. I've looked everywhere for some sort of new configuration option to correct this, but to no avail. What am I missing?

    No, that's not the issue. I am writing simple text in an outgoing message, then highlighting a few words (such as "click here to visit the site"), then when I use any of the three methods to assign a link to those highlighted words (Ctrl L, insert/link, or clicking on the little blue screen icon), the normal window opens with a box to insert the URL, but when I try to PASTE such a saved URL into that box, the aforementioned error message appears. Note that I can manually TYPE a URL into that box with no problem, but version 31 will not allow me to PASTE one. I've always successfully used exactly that procedure with prior versions.
    Note also that when I insert an image into an outgoing message and try to paste a link to it in the same way, the same error message pops up. That also always worked in prior versions.
    Because e-mail is crucial to me, I have now re-installed a prior version (24.6.0) of Thunderbird in which this function works perfectly, so for now, problem solved. But I hope you can fix this so I can use future versions.
    BTW ... I'm using Windows 7 Professional on a PC running an Intel 64-bit 7 core processor.

  • Insert link is not functioning properly. Please help.

    Hello :)
    My insert link option used to work just fine.
    Recently, it is not allowing me to do this and I cannot understand why.
    All I get is 'NO NAMED ANCHORS OR HEADINGS IN THIS PAGE'. This is VERY frustrating!
    Please help me as I need to send many links for work,and I don't know how else to do it.
    Thank you.

    Is the cursor in the message text area? Have you already entered any message text when you try to insert your link?

  • Cannot "insert link from km" in WPC

    Hi. We have EP 7.0 SPS21 implemented. I am experiencing issues with WPC, in that I am now not able to "insert link from km" when in edit mode inside a paragraph or Advanced paragraph. I goto the path of the .PDF file in KM & select it, but the link is not created. This is now happening after we implemented SPS21.
    Please advise.
    Kind Regards,
    M.

    Good Morning Aliaksandr. Thank-you for your prompt response. See below for the versions of the components. Plse advise...
    sap.com  CORE-TOOLS  7.00 SP21 (1000.7.00.21.0.20091214120657)  SAP AG  SAP AG  20100220101007 
    sap.com  EP-PSERV  7.00 SP21 (1000.7.00.21.0.20100122081155)  SAP AG  SAP AG  20100220110545 
    sap.com  EP-WDC  7.00 SP21 (1000.7.00.21.0.20091214203918)  SAP AG  SAP AG  20100220110619 
    sap.com  EPBC  7.00 SP21 (1000.7.00.21.0.20091214203545)  SAP AG  SAP AG  20100220102617 
    sap.com  EPBC2  7.00 SP21 (1000.7.00.21.0.20091214203611)  SAP AG  SAP AG  20100220110621 
    sap.com  FORUMS  7.00 SP21 (1000.7.00.21.0.20091214174900)  SAP AG  SAP AG  20100220110816 
    sap.com  JLOGVIEW  7.00 SP21 (1000.7.00.21.0.20091214103400)  SAP AG  SAP AG  20100220101027 
    sap.com  JSPM  7.00 SP21 (1000.7.00.21.0.20100120140600)  SAP AG  SAP AG  20100220084503 
    sap.com  KM-KW_JIKS  7.00 SP21 (1000.7.00.21.0.20091214120914)  SAP AG  SAP AG  20100220102636 
    sap.com  KMC-BC  7.00 SP21 (1000.7.00.21.0.20091214203935)  SAP AG  SAP AG  20100220110821 
    sap.com  KMC-CM  7.00 SP21 (1000.7.00.21.0.20100122081448)  SAP AG  SAP AG  20100220110827 
    sap.com  KMC-COLL  7.00 SP21 (1000.7.00.21.0.20091214204159)  SAP AG  SAP AG  20100220110847 
    sap.com  KMC-UI  7.00 SP21 (1000.7.00.21.0.20091214174900)  SAP AG  SAP AG  20100220105719 
    sap.com  KMC-WPC  7.00 SP21 (1000.7.00.21.0.20091214174600)  SAP AG  SAP AG  20100220110850
    sap.com  LM-PORTAL  7.00 SP21 (1000.7.00.21.0.20100118101206)  SAP AG  MAIN_APL70P21_C  20100220110853 
    sap.com  LM-TOOLS  7.00 SP21 (1000.7.00.21.0.20100118110644)  SAP AG  MAIN_APL70P21_C  20100220104212 
    sap.com  NET-PDK  7.00 SP21 (1000.7.00.21.0.20091214151400)  SAP AG  SAP AG  20100220105741 
    sap.com  RTC  7.00 SP21 (1000.7.00.21.0.20091214194600)  SAP AG  SAP AG  20100220105746 
    sap.com  RTC-STREAM  7.00 SP21 (1000.7.00.21.0.20091214194600)  SAP AG  SAP AG  20100220110858 
    sap.com  SAP-EU  7.00 SP21 (1000.7.00.21.0.20100118101502)  SAP AG  MAIN_APL70P21_C  20100220111419 
    sap.com  SAP-JEE  7.00 SP21 (1000.7.00.21.0.20091214121301)  SAP AG  SAP AG  20100220101108 
    sap.com  SAP-JEECOR  7.00 SP21 (1000.7.00.21.0.20091214121410)  SAP AG  SAP AG  20100220101344 
    sap.com  SAP_JTECHF  7.00 SP21 (1000.7.00.21.0.20091214121505)  SAP AG  SAP AG  20100220101432 
    sap.com  SAP_JTECHS  7.00 SP21 (1000.7.00.21.0.20091214121635)  SAP AG  SAP AG  20100220103234 
    Kind regards,
    Melvin

  • Insert/link a PDF file in MM02 transaction.

    hi
    I would like to know if it is possible to insert/link a PDF file in MM02 transaction.
    Please let me now something.

    Hi Vale,
      I think that it would be possible to insert the pdf file to the MM02 transaction: Please try following the below steps:
    1) Follow the path : MM02 -> System -> Service for Object -> Create -> Create External Document (URL).
    2) You will get a popup saying "Create a link for Web page".
    3) Fill in the required details as per the requirement. Give the appropriate title, Location for the file to be attached ( Path ),
    4) Click on Execute button, SAVE.
    Note: Please remember to provide the file extension like .pdf while attaching the file. Else the file wont be displayed when you try to display the attached file.
    Thanks
    Pawan

  • On Yahoo Mail, the "insert link" function stopped working

    For the past few months, the "insert link" function doesn't work properly when trying to insert a link into a message. It inserts the link in the wrong place. For example if i paste the following text into a message:
    Regards,
    Jeff
    http://mywebsite.com
    and then if i highlight the URL, copy it, click the "insert link" icon, and paste the URL, it does something crazy like this:
    Regards,http://mywebsite.com Jeff
    or it makes the entire 3 lines of text a clickable link, instead of just the URL.
    It works fine in Internet Explorer.
    Things i've tried in Firefox 26.0:
    - disabled all add-ons (then restared browser)
    - cleared cache
    - cleared all Yahoo cookies
    By the way, in Internet Explorer, pasted URLs automatically appear as links in Yahoo Mail without having to click "insert link". I wish Firefox enabled this, because it's very time consuming to manually create lots of links. Any plans for improving this?

    I'm struggling to understand the difference between tabbing into the message body and clicking in it. I typed ''I'm mystified!'' and then copied the HTML as of that point. Then I selected mystified and added a link, and copied the new HTML (attributes of the initial div tag removed):
    (1) Before adding the link
    (A) Tab in
    &lt;div>'''I'm mystified!'''&lt;br><br>&lt;p id="yui_3_13_0_ym1_13_1390977543218_8">&lt;span>&lt;br class="yui-cursor">&lt;/span>&lt;/p><br>&lt;div id="yui_3_13_0_ym1_13_1390977543218_10">&nbsp;&lt;/div><br>&lt;div id="yui_3_13_0_ym1_13_1390977543218_12">'''-Jefferson'''&lt;/div>&lt;/div>
    (B) Click in
    &lt;div>&lt;p id="yui_3_13_0_ym1_12_1390977543218_8">&lt;span id="yui_3_13_0_ym1_12_1390977543218_15">'''I'm mystified!'''&lt;br class="yui-cursor">&lt;/span>&lt;/p><br>&lt;div id="yui_3_13_0_ym1_12_1390977543218_10">&nbsp;&lt;/div><br>&lt;div id="yui_3_13_0_ym1_12_1390977543218_12">'''-Jefferson'''&lt;/div>&lt;/div>
    (2) After adding the link
    (A) Tab in
    &lt;div>'''I'm''' &lt;a href="http://asdf">&lt;font id="yui_3_13_0_ym1_13_1390977543218_16">'''<u>mystified</u>'''&lt;/font>&lt;/a>'''!'''&lt;br>&lt;p id="yui_3_13_0_ym1_13_1390977543218_8">&lt;span>&lt;br class="yui-cursor">&lt;/span>&lt;/p><br>&lt;div id="yui_3_13_0_ym1_13_1390977543218_10">&nbsp;&lt;/div><br>&lt;div id="yui_3_13_0_ym1_13_1390977543218_12">'''-Jefferson'''&lt;/div>&lt;/div>
    (B) Click in
    &lt;div>&lt;p id="yui_3_13_0_ym1_12_1390977543218_8">&lt;a href="http://asdf">&lt;font id="yui_3_13_0_ym1_12_1390977543218_18">'''<u>mystified</u>'''&lt;/font>&lt;/a>&lt;span id="yui_3_13_0_ym1_12_1390977543218_15">'''I'm !'''&lt;br class="yui-cursor">&lt;/span>&lt;/p><br>&lt;div id="yui_3_13_0_ym1_12_1390977543218_10">&nbsp;&lt;/div><br>&lt;div id="yui_3_13_0_ym1_12_1390977543218_12">'''-Jefferson'''&lt;/div>&lt;/div>

  • Is there a keyboard shortcut to Insert Link?

    So some options like Bold, Underline, Italics have keyboard shortcuts.
    Has any one figured out a keyboard shortcut to Insert Link? What about Insert Photo?
    What about a keyboard shortcut for pasting the text in the clipboard in as plain text?

    Couple of ways to do that.
    Great. I'll give it a shot...
    1) Use the Quote icon to quote and requote the message being replied to, then delete all the stuff not wanted for each instance. That's too tedious for me.
    Agreed.
    2) Copy and Paste the selected parts of the message being replied to. Once one part is pasted in, select it again in the compose box and click the Quote icon. Repeat as needed. When you select text in a compose box and click the Quote thingie, instead of quoting the previous message it will set off the selected text in quoted style.
    So that's the secret. Thanks!
    I use the second method, but with a variant. If I know I'm going to be chopping up the replied to message like that, I just copy/paste the whole thing into the compose box. Then I break it up, adding a response to one section before moving down and adding a response to the next section. The last thing I do before posting is to select each of the pasted parts and click the Quote thingie.
    The reason I wait until the end to set them off in quoted style is that although you can undo the quoted format, it's not convenient to do so. I find it easier to get all my tweaking done first.
    Makes sense, as long as you don't inadvertently apply the quote thingie to your own response, but I guess that can be fixed.

  • Sharepoint 2010 add/edit form: Insert link from sharepoint disabled

    Hello!
    I have a list with enhanced rich textbox field. I can click on Insert link, "from addres" is enabled, but "from Sharepoint" is disabled.
    Is there a reason why is this button disabled? Field is enhanced rich textbox... Paste button is also disabled.
    Thanks

    Microsoft says
    it is an issue but you can check
    design this strange behavior on other occasions:
    If we have a Web page in the root
    of the site and insert a Web Part content "from SharePoint" will
    disabled, but if this same Web Part Page
    is in a library "from SharePoint"
    is enabled What is the difference? I do not know.
    Worse. If we insert the Web Part
    to a page in the root of the site is
    a list or library that has a link produced by a
    workflow, an error as seen in
    http://www.danielroot.info/2010_07_01_archive.html
    But the link works correctly if the
    page is within a library.
    Are these design issues also?
    Sorry for my English.
    Soy Miguel de Torre Arias

  • Missing Insert Link while Creating InfoSet

    Dear All,
                   When I was Creating an Infoset the insert link for inserting a new info provider is missing. (Both from RSA1 and RSISET)
    There is a setting in the SPRO under the tab BI Settings> Performance settings> Infoset Settings.
    Here we need to mention number of where conditions. Ideally what should be the number?
    Please answer this is urgent for me.
    Points assured.
    Regards
    Mahesh

    no answer.

  • Insert Link from Km

    Hi Experts,
    When I send any document by clicking 'send to' command, I am not getting HTML Editor function
    'Insert Link From Km' though the options are selected in the HTML Editor.
    Is this a correct functionality?
    Regards,
    Atul Bhatia

    Hi,
    When you use 'send to' for a document in KM a HTML editor window with send email opens up.
    it contains a html editor with a link displaying the document you want to send. In addition you can also upload and attach a file.
    If this does not appear check your KM configuration.
    Regards,
    Melwyn

  • Inserting links in a form

    Can I insert [hyper]links into a form to be deployed as a PDF dopcument? I'd like to allow respondents to navigate around the form.

    Hi,
    Not in the FormsCentral authoring environment. After you generate the PDF using FormsCentral, it's possible to use Adobe Acrobat to add the navigation links. Please read the following FAQ before you try to edit the PDF in Acrobat:
    http://forums.adobe.com/docs/DOC-3661
    Regards,
    Brian

  • RH11: Problem insert linked FM data (FM10 or FM12) in a Robohelp project

    Hi all!
    We have 2 very newTCS 5 installations (3.5 updates):
    All existing RH projects include linked FM data.
    On one of the workstations we have severe problems.
    The old RH9 projects are working.
    BUT The new RH11 projects are looping in endless calculation, when I try to update
    existing projects or when I insert a linked FM in a new project.
    The error message (after 10 minutes) tells, that the FM file is not a propper FM file or Framemaker should be installed.
    FM 10 and 12 are installed and the files can be loaded without error. FM works without problems.
    As this problem occurs only on one station, we looked for
    the differences, but without a result.
    We have re-installed the RH11, but without a change.
    What else can we do?
    Please help!!

    I have a machine set up with multiple versions of TCS and they run fine. That said, I would be linking with Word rather than Fm.
    I notice you start by saying TCS and then mention reinstalling Rh. I am wondering if the problem is with Rh seeing Fm as part of TCS rather than as a separate app. You can only link with Fm if it has been installed as part of TCS rather than as a separate app.
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

Maybe you are looking for