Example #1
0
 /// <summary>
 /// 选择图片
 /// </summary>
 /// <param name="val"></param>
 private void selectedImage(HtmlEditor.Event eventType, string val)
 {
     HtmlEditorImageWindow imgWin = new HtmlEditorImageWindow();
     imgWin.Owner = WPFUtil.FindAncestor<Window>(this);
     imgWin.EventType = eventType;
     if (eventType == Event.Update)
         imgWin.Img = val;
     imgWin.HtmlEditorImageChangedEvent += OnHtmlEditorImageChangedEvent;
     imgWin.ShowDialog();
     imgWin.HtmlEditorImageChangedEvent -= OnHtmlEditorImageChangedEvent;
 }
Example #2
0
 public HtmlEditorRuntime(HtmlEditor HtmlEditor)
 {
     this.HtmlEditor = HtmlEditor;
 }
Example #3
0
 void OnHtmlEditorImageChangedEvent(HtmlEditor.Event eventType, ASObject value)
 {
     StringBuilder sb = new StringBuilder();
     sb.Append("<img src='").Append(value.getString("path")).Append("'");
     if(value.ContainsKey("width"))
         sb.Append(" width='").Append(value.getString("width")).Append("px'");
     if (value.ContainsKey("height"))
         sb.Append(" height='").Append(value.getString("height")).Append("px'");
     if(value.ContainsKey("alt"))
         sb.Append(" alt='").Append(value.getString("alt")).Append("'");
     sb.Append(" />");
     if(eventType == Event.Create)
         runtime.call("HtmlEditorInsertContent", new object[] { sb.ToString()});
     else if(eventType == Event.Update)
         runtime.call("HtmlEditorReplaceContent", new object[] { sb.ToString() });
 }