TinyMCE link url not having the protocol - tinymce

I have added Link plugin to TinyMCE.
However, when I use a URL from the same site the TinyMCE is displayed, it does not retain the URL as it is in the URL field in the 'Insert/Edit link' dialog box (This happens when I click 'Save').
How can I retain the full address (including the protocol as I have typed) in the URL field?
Note: I need to retain this URL as it is with the protocol as I sanitize the URLs which have no protocol mentioned. Thus, I really need to have the URL exactly as I type in the URL field.

There are a variety of configuration options that tell TinyMCE how to deal with URLs. The documentation for these settings can be found here:
https://www.tiny.cloud/docs/configure/url-handling/
In particular I believe you want these two settings:
relative_urls : false,
remove_script_host : false
I have created a TinyMCE Fiddle to show these in action: http://fiddle.tinymce.com/xVgaab/1
If you comment out the two settings referenced above you will see the behavior of the link href changes.

Related

AEM Link Checker: How to prevent the Link is removed if it is INVALID

I have a request from PM to prevent AEM automatically removing the invalid link in Publisher.
Here are from AEM Document :
Internal links are validated as soon as the content author adds an internal links to a page. If the link becomes invalid:
It is removed from the publisher. The text of the link remains, but
the link itself is removed.
It is shown as a broken link in the
authoring interface.
I tried with many settings but it didn't work for me. Anyone knows the anwser?
I really appreciate your help.
Thank,
Duc
You can add x-cq-linkchecker="valid" attribute in the tag to make sure that links are always mark as valid by AEM. In this case link checker will check the link but will mark it valid. ( For Ex:- <a x-cq-linkchecker=”valid” …>)
You can optionally use x-cq-linkchecker="skip" attribute in the tag as well. In this case link checker will not even check for validity for link. ( For Ex:- <a x-cq-linkchecker=”skip” …>)

Link query strings get cut off

I'm not aware of link designing strategies, so I am not sure why my link gets chopped off when someone clicks on from sources like Facebook etc.
I have a 'share feature' on my platform, which lets a user create a link to their listing and share it with people.
The link I generate for the listing in my backend has parameters, which reads the listing id and the type and displays content over HTML
Here's a sample link for a listing
https://www.fayvors.com/Share.html?hash=5eccccaa-7b8d-42bd-af8c-08d50da0c867?type=lessons/
However, when I share the link on facebook and click it, the browser redirects to a link that's cut off
https://www.fayvors.com/Share.html?hash=5eccccaa-7b8d-42bd-af8c-08d50da0c867%3Ftype%3Dlessons
I'm not aware of link designing principles, so I'm a bit lost here!
Thanks!
Your URL contains “special characters” (like a second question mark inside the query string), but you neglected to apply proper URL encoding when putting this URL as a parameter value into another URL:
javascript:window.location.replace('https://www.facebook.com/sharer/sharer.php?u='+window.location)
Use encodeURIComponent on the value you are concatenating to the sharer URL here.

How to use in-page HTML anchors with hashbang URLs (in GWT)?

I have a little problem with implementing in-page HTML anchors while also having bookmarkable URLs via hashbang. The description is easy:
I visit some URL of my application: http://www.mypage.com/Test.html#!mycontent
On this page there is a lot of text and I need some HTML anchors for navigation. In old-style HTML I'd write AnchorText.
But when I click this link in my GWT application, the URL changes to: http://www.mypage.com/Test.html#myAnchor
GWT Platform recognized the change and throws me back to my DefaultPlace. That's clear because it can't associate the URL to a presenter.
So now the (simple) question is: How can I use in-page navigation while also having hashbang URLs?
How do you construct your anchor?
In case you are doing it statically, why now just add the ! to the href?:
AnchorText
Update:
Ok Instead of an normal Anchor you can use a Hyperlink or InlineHyperlink and set the targetHistoryToken value to #!myAnchor:
<g:InlineHyperlink ui:field="diversityLink" targetHistoryToken="!#myAnchor">MyAnchor</g:InlineHyperlink>

Extracting the URL of an external link to use as a constant

I have defined some external links to store URLs to which other pages can link to. This way a change of URL by a backend user is reflected sitewide.
I wish to extract these URLs to text to put them them into a newsletter as that would be a better practice than redirecting through the site. How could I go about this ?
You may use a placeholder in the rte link dialog (I assume you use the rte to write your newsletter) and then replace this placeholder in a custom hook (search for contentPostProc-all). There you can read your typoscript config or from any other place (own db table, csv, whatever).
You may also use the browse link dialog hook to add your custom links. Take what fits best for you.

Cannot use named anchors with Facebook tab link

I'm attempting to put a named anchor on a part of our Facebook tab and add "#anchor" to the shared URL so when users click the shared link it will take them directly to the proper content on the tab.
I added to my tab and then recoded the FB Feed Dialog URL so
link=http://www.facebook.com/mybhg?sk=app_279723102083145#quiz
and
actions={name:'name',link:'http://www.facebook.com/mybhg?sk=app_279723102083145#quiz'}
In testing the dialog displayed an error saying both of these were invalid links:
Requires valid redirect URI
actions should be a JSON-encoded dictionary with "name" and "link" keys
So I bit.ly'd them which Facebook accepted and you can share the short URL. When users click the shared link though, the correct URL is used (with "#quiz") but the browser does not snap to the anchor location.
Since FB failed on the original URL, I suspect they aren't set up to parse #named anchors in their URLs, but I wanted to put it out to the community and see if someone has made it work (or confirmed it doesn't.)
Thanks!
URL fragments (the #) can't be read on the server side.
What you can do is use the app_data parameter, which is forwarded to you on the signed_request parameter, parse it accordingly, and have some Javascript to force the jump yourself.