Try our conversational search powered by Generative AI!

Linus Ekström
Apr 16, 2013
  3475
(0 votes)

Sending settings from the server to your editor

I got a question how you can send settings that are defined on the server to an editor. It’s really quite simple so lets have a look on a simple example. We start by defining an editor descriptor and adding an entry in the EditorConfiguration dictionary:

[EditorDescriptorRegistration(TargetType = typeof(string), UIHint = "author")]
public class AuthorEditorDescriptor : EditorDescriptor
{
    public AuthorEditorDescriptor()
    {
        ClientEditingClass = "alloy.editors.AuthorSelector";
        EditorConfiguration["foo"] = "bar";
    }
}

The settings in the EditorConfiguration dictionary is mixed on to the editor instance when started so you can access these settings as they were regular properties of your editor. This sample checks the value of foo in the postCreate-method:

postCreate: function () {


    if (this.foo === "bar") {
        alert("Happy happy joy");
    }
},

And when the editor starts we get:

image

Apr 16, 2013

Comments

Please login to comment.
Latest blogs
Azure AI Language – Extractive Summarisation in Optimizely CMS

In this article, I demonstrate how extractive summarisation, provided by the Azure AI Language platform, can be leveraged to produce a set of summa...

Anil Patel | Apr 26, 2024 | Syndicated blog

Optimizely Unit Testing Using CmsContentScaffolding Package

Introduction Unit tests shouldn't be created just for business logic, but also for the content and rules defined for content creation (available...

MilosR | Apr 26, 2024

Solving the mystery of high memory usage

Sometimes, my work is easy, the problem could be resolved with one look (when I’m lucky enough to look at where it needs to be looked, just like th...

Quan Mai | Apr 22, 2024 | Syndicated blog

Search & Navigation reporting improvements

From version 16.1.0 there are some updates on the statistics pages: Add pagination to search phrase list Allows choosing a custom date range to get...

Phong | Apr 22, 2024