public override RmlElementEditor openEditor(Element element, GuiFrameworkUICallback uiCallback, int left, int top) { elementStyle = new TextElementStyle(element, false); elementStyle.Changed += elementStyle_Changed; String rml = TextElementStrategy.DecodeFromHtml(element.InnerRml); textEditor = new ElementTextEditor(rml); String actionName = element.GetAttribute("onclick").StringValue; if (String.IsNullOrEmpty(actionName)) { actionName = Guid.NewGuid().ToString(); element.SetAttribute("onclick", actionName); } SlideAction action = slide.getAction(actionName); if (action == null) { action = ((Func <String, SlideAction>)actionTypeBrowser.DefaultSelection.Value)(actionName); slide.addAction(action); } //Make copy of action, this is really important, a lot of the function of this editor assumes this //is copied. SlideAction editingAction = CopySaver.Default.copy(action); EditInterface editInterface = setupEditInterface(editingAction, slide); actionEditor = new EditInterfaceEditor("Action", editInterface, uiCallback); appearanceEditor = new EditInterfaceEditor("Appearance", elementStyle.getEditInterface(), uiCallback); RmlElementEditor editor = RmlElementEditor.openEditor(element, left, top, this); editor.addElementEditor(textEditor); editor.addElementEditor(actionEditor); editor.addElementEditor(appearanceEditor); return(editor); }
private bool build(Element element) { String text = textEditor.Text; element.InnerRml = TextElementStrategy.EncodeToHtml(text); StringBuilder style = new StringBuilder(); elementStyle.buildStyleAttribute(style); if (style.Length > 0) { element.SetAttribute("style", style.ToString()); } else { element.RemoveAttribute("style"); } StringBuilder classes = new StringBuilder(); classes.AppendFormat("{0} ", primaryClassName); elementStyle.buildClassList(classes); if (classes.Length > 0) { element.SetAttribute("class", classes.ToString()); } else { element.RemoveAttribute("class"); } if (currentAction != null) { element.SetAttribute("onclick", currentAction.Name); } return(true); }