Rich Text Editor Autosave after 1 min sitecore 9.3 - sitecore

I want to save the Rich Text Editor value automatically. Like during content updating, content should automatically be saved after 1 minute. I got this link https://sitecoregadgets.blogspot.com/2011/11/rich-text-auto-save.html. But solution files are not available at the given link. I also tried using javascript to hit the "Accept" button in the rich text editor, but the editor closed that case. 
Following code write down for testing:
setTimeout(function(){
scSendRequest(event, 'editorpage:accept'); // This is call to RTE Accept button.
var test =document.getElementsByClassName("scRibbonToolbarLargeButton");
test[0].click(); // This is call to the ribbon save button
},30000);
Auto save RTE value.

Related

Adding HTML Text the right way in Experience editor

Our content author is more comfortable using Experience editor than the content editor and also has knowledge of HTML.
The requirement is - the author should also be able to add text - along with other components (carousel, banner, etc), or just create a whole HTML page using Rich text editor if they need to.
For eg: He will open Experience editor of a page, add a banner component and then below the banned wants to add text. (or maybe just design the whole page using HTML)
I'm handling this kind of task for the first time and here is what I did.
Create the following:
1. A template with the name "Rich Text Section", which has one field "Content" of type "Rich Text".
2. A View Rendering, "Rich Text Component", that points to a .cshtml which is a simple HTML
<div class="row">
#Html.Sitecore().Field("Content", Model)
</div>
A folder "Rich Text Sections" under Sitecore > Content > Home > Components. In this folder, the author can add only "Rich Text Section" templates.
To add text to/or design a page, the author needs to do the following.
Browse in content editor mode. Add a new item (say "LoremIpsum"), of template type "Rich Text", inside the "Rich Text Sections" folder.
Browse in Experience editor mode. Add the "Rich Text Component", set its data source to "LoremIpsum", and then write all the HTML content inside.
Here, the author has to switch to both editor modes. Please advise the better way to do this.
If you have the Insert Options set up correctly on the items in your solution, then from the Experience Editor you can use Insert Page from the Home tab on Ribbon. This will then pop up a modal showing all the Templates that have been configured as Insert Options, the same ones as if you were to right click on a node in the Content Editor and select the Insert option.
The page will be created as a child of the page you are currently on. You can navigate to different sections of the content tree by enabling the Navigation Bar option from the View Ribbon, selecting the page and selecting "Go".
EDIT: I mis-read your question. It seems you are trying to create the Datasource of the item when a component is added using the Experience Editor.
You need to set the Datasource Location and Datasource Template fields on the definition item of your Rendering:
Make sure you leave the Data source field empty on the Rendering item. Now when you add the component you will be prompted to Select the Associated Content. Your editors will be able to select existing content or create new ones.
You can read more in this blog post.

How to show "edit image" in Sitecore experience editor?

In sitecore "content editor" we can use the "image editor" by clicking "edit image" in the data section, but in the experience editor it is not visible.
is there a way to make available for editors to use the image editor? or this behavior is a sitecore standard?
thanks for help
Picture field
I've just written it up in a blog post.
First you'll need to add a new button under
/sitecore/system/Field types/Simple Types/Image/WebEdit Buttons
You can duplicate one of the existing ones and change the icon and text yourself. Make the contents of the Click field:
chrome:field:editcontrol({command:"webedit:changeimage"})
(there's already a webedit:editimage so we can't name it that).
Open App_Config\Include\Sitecore.ExperienceEditor.config and duplicate the entry for webedit:chooseimage. Change the command name to webedit:changeimage as per above. Then change the type to the class you will create below.
If you have access to a decompiler, take a look at the existing command Sitecore.Shell.Framework.Commands.Shell.EditImage as well as the existing command
for selecting an image in Experience Editor Sitecore.Shell.Applications.WebEdit.Commands.ChooseImage. You'll see that they're similar, but unfortunately they use two different
methods of opening a dialog (Windows.RunApplication and SheerResponse.ShowModalDialog) so we can't reuse the existing class as-is. I have created a class that uses a bit of both (link below).
Create your class (eg. EditImage.cs), make it serializable and inherit from WebEditImageCommand like the other EE buttons. I have posted the full class as a gist for you.
When you select an image in the Experience Editor, you should now have an extra button in the list which opens the image editor in a modal window when clicked.
You need to do next steps, is not the most elegant way but you can do it:
In the Experience Editor, click the image that you want to edit, and in the floating toolbar that appears, click More and then Edit the related item. This opens the item in the Content Editor, from where you can scroll to the field that contains the image and click Edit image.

Sitecore 8, MVC, Experience Editor: How to make a rendering refresh after a Field Editor Button has been used

We have a rendering listing the selected items in a TreeSelect in the current item. In our case we call them "Tags" (1)
We have added a Field Editor Button to the component to let the editor change selected items. (2) (As described on for example Adding a custom component)
When an editor clicks (2) the editor window (3) it is opened in a dialog. The editor may select different items(called tags in our case) using the TreeSelect.
When the editor presses the ok-button (4) the values are set.
Now to the problem:
The values are actually set as they get stored when the editor presses the Save button but we want our list on the page (1) to immediately reflect the set items when the editor presses the ok-button (4), i.e. before having to actually save the whole item.
How do we achieve that?
(I am in contacts with Sitecore support but so far I have not gotten any answers...)
Update
After a lot of conversation with the support we still have no useful solution.
We tried turning it into a field renderer displaying the links.
What worked was:
The field do get updated when you have edited it in the popup field editor. (but...)
It looks good the first time when page is loaded.
You can make a WebEdit button with commands to edit the field and add it as Custom button to the field (register <command name="webedit:fieldeditor" type="Sitecore.Shell.Applications.WebEdit.Commands.FieldEditor, Sitecore.Client"/> and set Click on the button to webedit:fieldeditor(command={3473DDA1-2983-493C-AF7A-054C75AA7AD3},fields=NameOfField where the guid points to itelf and an "Icon" is set on it.)
What didn't work was:
The field get updated by the raw value, not what I want to display. Server code is involved, but not in the rendering of html-code.
When I want to edit the value in the field editor, the value sent to the field editor is not the raw value but what actually is displayed on the page. (I guess this can be solved somehow)
The issue to the support turned into a feature request to let the server be involved in rendering the field, not just sending a new value to the JavaScript updating it. The server does the first rendering so when it already is involved in updating, it should be allowed to do the rendering the following times too.
We have decided to not spend more time on this right now (we have other things to do too.) and have a bad editor experience as the field not get updated until the editor actually saves the item.
Still we have no suitable solution for this issue. If you want to keep working on it and want a reference to my issue it is 439059.
This may not be useful here. I've done this in normal sites, but not in Sitecore. But, here's one possibility....
This is a situation where you would pass a callback function to the child popup window. This callback will cause the caller / parent window to re-read/re-load the information that was just updated by the child.
Example:
User presses (2) to open Editor Window(3) (Editor window is opened and the Callback function is passed as a parameter)
User presses "OK" button (4). The "OK" button event handler updates the changes, then calls the Callback function which re-loads the now updated information, and closes the popup window.
Once the popup closes, the parent window now displays the information that the popup/editor just updated.
This takes some client side javascript (jquery) development but it is quite do-able normally.

sitecore - dot in rich text editor

I'm finding that some strange things are happening with my rich text editor in Sitecore 6.6. Some users have been entering content that is breaking items. Looking at the text it seems fine but when I copy the text into notepad I can see this dot character "·"
Any time this is in the text editor clicking Show Editor does nothing and I can't view raw values either. When I click Edit Html the edit box comes up but my changes will never save, the only way I can seem to fix these pages is if I update the content straight into the database.
Is there a way I can:
Prevent these characters from getting into the database,
Update the content without having to run update statements on the database?
Thanks in advance.

Sitecore: Programmatically Exit Edit Mode in Page Editor

When in Sitecore's Page Editor mode clicks the Edit button, I have a DIV's style set to
top: 0;
so that it appears on top of the Page Editor buttons (Save, Save and Close, Insert, etc..). This div prevents the content editor from using the normal Page Editor buttons and forces them to use the custom Save, Save and Close, and Close buttons that I have added to the DIV.
Is there a way to programmatically exit Edit mode whenever they click on my custom Close or Save and Close button? I do not want to log them out of the Page Editor (just exit them out of edit mode). I only have 1 page where I am doing this, so I would rather not get into changing configurations in Sitecore to achieve this.
Check out this post: In Sitecore, how to change or set PageMode
It looks like you can do:
Context.Site.SetDisplayMode(Sitecore.Sites.DisplayMode.Normal, Sitecore.Sites.DisplayModeDuration.ResetAfterRequest);
Or, you can add sc_mode=normal or sc_mode=preview to the URL's query string.