Example #1
0
 void ApplyModel(IModelHtmlEditor modelHtmlEditor, ASPxHtmlEditor htmlEditor, HtmlEditorCustomDialog htmlEditorCustomDialog)
 {
     ApplyModel(modelHtmlEditor, htmlEditor, ApplyValues);
     ApplyToolbarModel(modelHtmlEditor, htmlEditor, modelHtmlEditor.GetPropertyName(editor => editor.ToolBars));
     ApplyShortcutModel(modelHtmlEditor, htmlEditor, modelHtmlEditor.GetPropertyName(editor => editor.Shortcuts));
     ApplyCustomDialodModel(modelHtmlEditor, htmlEditor, modelHtmlEditor.GetPropertyName(editor => editor.CustomDialogs), htmlEditorCustomDialog);
 }
Example #2
0
        void ApplyCustomDialodModel(IModelHtmlEditor modelHtmlEditor, ASPxHtmlEditor htmlEditor, string propertyName)
        {
            var editorCustomDialogs = (IModelHtmlEditorCustomDialogs)((ModelNode)modelHtmlEditor)[propertyName];

            foreach (var modelCustomDialog in editorCustomDialogs.OfType <ModelNode>())
            {
                var editorCustomDialog = htmlEditor.CustomDialogs[modelCustomDialog.Id];
                if (editorCustomDialog == null)
                {
                    var htmlEditorCustomDialog = new HtmlEditorCustomDialog();
                    ApplyModel(modelCustomDialog, htmlEditorCustomDialog, ApplyValues);
                    htmlEditor.CustomDialogs.Add(htmlEditorCustomDialog);
                }
            }
        }
Example #3
0
        protected override void ApplyModelCore()
        {
            var htmlEditor      = Control.Editor;
            var modelHtmlEditor = ((IModelPropertyHtmlEditor)Model).HtmlEditor;

            if (htmlEditor != null)
            {
                var htmlEditorCustomDialog = new HtmlEditorCustomDialog();
                foreach (var editor in ((IModelPropertyHtmlEditor)Model).HtmlEditorModelAdapters.SelectMany(adapter => adapter.ModelAdapters))
                {
                    ApplyModel(editor, htmlEditor, htmlEditorCustomDialog);
                }
                ApplyModel(modelHtmlEditor, htmlEditor, htmlEditorCustomDialog);
                htmlEditor.CustomDialogs.Add(htmlEditorCustomDialog);
            }
        }
Example #4
0
        static ModelHtmlEditorCustomDialogNodesGenerator()
        {
            _htmlEditor = new ASPxHtmlEditor();
            Type customDialogTemplateType     = typeof(HtmlEditorCustomDialogTemlate);
            var  customDialogTemplateTypeName = customDialogTemplateType.Name;
            var  customDialog = new HtmlEditorCustomDialog(ModelHtmlEditorToolBarNodesGenerator.InsertFileCommand,
                                                           "Insert File...",
                                                           "~/UserControls/" + customDialogTemplateTypeName + ".ascx");

            _htmlEditor.CustomDialogs.Add(customDialog);
            customDialog.OkButtonText = "Insert";
            if (Debugger.IsAttached)
            {
                var path     = UserContolPath(customDialogTemplateTypeName);
                var contents = customDialogTemplateType.GetResourceString(customDialogTemplateTypeName + ".ascx");
                File.WriteAllText(path, contents);

                const string resourceName = ModelHtmlEditorToolBarNodesGenerator.InsertFileCommand + ".png";
                var          filePath     = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, @"Images\" + resourceName);
                customDialogTemplateType.WriteResourceToFile(resourceName, filePath);
            }
        }