How to get rendered XHTML from a Wicket panel - xhtml

Users of my Wicket application should be able to edit some of the panels' output (X)HTML. There will be a button or link on each panel that, when clicked, will get the rendered content and use/open an editor such as TinyMCE.
I think I want some sort of getRenderedXTML() method for the panel, but have no clue how to get the rendered output programmatically. How can I do this?

You can likely get the generated html just before it's sent to the browser, but this is a bad approach as reconnecting the edited html back the the generating fragments will be painful if not impossible.
Rather than actually trying to edit the dynamic markup, make the user-editable stuff part of the data. Show it in a Label and use setEscapeModelStrings(false) to allow the label to properly render the html fragment. On click of your link, replace that label with a textarea with tinymce behavior attached.
There is a some tinymce support in wicketstuff-core that can help with this, and this Wicket by Example article shows a bit of how to use it, though it may be a bit out-of-date, and references document locations no longer available.

Related

Xamarin Forms, Adding items dynamically inside CarouselView on the run, Strange Behaviour

I use the same DataTemplate to populate some of the views inside my CarouselView: a XAML file with a ContentView. I assign a custom class list to ItemsSource of the carouselview AND use bindings inside the template layout fields to fill them with the properties of my custom class. Everything is working fine. Here comes the wierd part: Let's say there's a button in the template and when you click it on the screen, a Label with "Well Done" text is added to the current Stacklayout of the shown carouselview. This is done by the codebehind of my template XAML. This is ok, too, but I expect this "Well Done" to disappear after I swipe back and forth enough. Because it's not part of the template. It does not disappear, instead I see it on other carousels once in every 4 swipes and it is replaced, I mean it appears on different carousels if I swipe back and forth. To make it disappear completely I have to swipe away from the views that share the same DataTemplate. I cannot understand the mechanics behind this behaviour. I can create another field inside the template to put the "Well Done" text there and show it when the time comes, I know. But I want to understand the mechanics. Thank you.
Asking the right question about a problem is the key to any solution..
After the realization that I've mentioned at the Update comment, I've searched for DataTemplate Caching and found this issue post on Xamarin.Forms Github: https://github.com/xamarin/Xamarin.Forms/issues/9200
There you can find an explanation to how CollectionView was designed and understand the mechanics behind the behaviour. No bug. It's by design.

Wordpress editor: lock editing part of page

My client wants to edit pages content in Wordpress. I had to disable visual editor because it ruins custom html. The problem is my client isn't familiar with HTML.
What I want is to lock part of source code in WP editor for ex. in line
<div class="whatever">Lorem ipsum</div>
I want to allow him to modify only "Lorem ipsum" part.
How can I do that?
well you can provide a textarea for him to enter text and then replace html inside element with class whatever, so basically you control regions of html where modifications can be made instead of whole page, of-course you need to write some code to do so.
I would simply mark the editable regions with some kinda class, and then on page load add some script which will pick all regions with that clas and show a small editable button there, on click of those button a shim with text area would pop up where user can add his text/html and on done, the markup would be injected inside the element. Later on save, the whole page would can be saved, little tricky but can work :)

Link jQuery-UI/Kendo-UI to make live changes to elements in page designer

I apologize if the title was not clear enough. I am working on a project where a user can design a page (something like Wix). I am continuing on a project left in-complete by some developer. The sequence of action is.
The user clicks on a link which adds an element on the page (e.g. textElement, picture, slider...)
There is an edit button for each element. Clicking which opens a dialog box.
On the dialog box there are sliders and color picker drawn using Kendo-UI. Using them the user can change the style settings for the element (e.g Font-Color, BG-Color, Font Size...)
What I want now is to apply/show the changes live on that element. I have the id available for each element. I can bind each of the style selectors and apply the changes live to the text element. But that does not seem the right choice as in future we might add another style selector in the dialog box, and that would mean adding the code for binding this new selector.
What I wanted to know was that is there an alternate or preferably easy way to do this?
Regards
Share some code with the basic idea that you follow, cause it's not getting clear what you did. It sounds like you can use the MVVM framework feature to help you for that.

ASP.NET FileUpload - How to change the language of the "Browse..." button description?

I know the very similar question was posted here already (How to change the Text of the browse button in the FileUpload Control (System.Web.UI.WebControls)) and I understand it's not possible to change the description to some custom text, but isn't it at least possible to change it to a different language (e.g. to English)?
I'd like to do it so that my web page is whole in one language (because e.g. "Procházet..." instead of "Browse..." in the middle of English web page looks kind of weird to me).
This is determined at the browser level, unless you moved to something like a flash-based uploader (or <iframe> trickery), you can't customize it. Whatever language/localization the user's browser is in (usually based on the OS setting), that's the language they'll get on the "Browse..." button.
If your page is for consumers likely already in that language, then you're all set, the default behavior works. If people with another language setting come by, well...that's the language they picked, so it should be an intuitive button label, even if it doesn't match.
Although there is direct way to change the Caption of InputFile control,but you can always go for alternative way,
Add InputFile control to you page let's say "fileUpload" and make it Hidden or invisible.
Add new HTMLButton on form with Text Whatever you wanted to give it to your fileupload button (in addition you can also add TextBox too to show uploaded file name when events being gets handle at server side).
Onclick even of above button use below javascript
document.getElementById("fileUpload").click();
It will do the same thing without showing up default InputFile control.
No, it's a matter of client's operating system.

Disable Ribbon Button

I want to disable and NOT hide a ribbon button (specifically Ribbon.ListItem.New.NewListItem) on a particular List type. On web I could find a lot many posts showing me ways to remove/hide buttons but none really worthwhile which could tell me how can I just disable an alrteady existing sharepoint button in my custom List type.
e.g. Following code does remove the button instead of hiding.
Id="RemoveRibbonButton"
RegistrationType="List"
RegistrationId="213908"
Location="CommandUI.Ribbon">
This can be done through Javascript on the client side. Check out this article for an example.
http://makarandrkulkarni.blogspot.com/2010/01/sharepoint-2010-ribbon-customization_23.html

Resources