Some cleaning up, and a fix for directive placeholders.
svn path=/trunk/aspeditor/; revision=49237
This commit is contained in:
Родитель
ce74746f33
Коммит
b2eb8ce0a6
|
@ -47,7 +47,7 @@ namespace AspNetEdit.Editor.ComponentModel
|
|||
{
|
||||
public static readonly string newDocument = "<html>\n<head>\n\t<title>{0}</title>\n</head>\n<body>\n<form runat=\"server\">\n\n</form></body>\n</html>";
|
||||
public static readonly string ControlSubstituteStructure = "<aspcontrol id=\"{0}\" width=\"{1}\" height=\"{2}\" -md-can-drop=\"{3}\" -md-can-resize=\"{4}\">{5}</aspcontrol>";
|
||||
public static readonly string DirectivePlaceholderStructure = "<!--<directiveplaceholder id =\"{0}\" />-->";
|
||||
public static readonly string DirectivePlaceholderStructure = "<directiveplaceholder id=\"{0}\" />";
|
||||
|
||||
string document;
|
||||
Hashtable directives;
|
||||
|
@ -180,9 +180,9 @@ namespace AspNetEdit.Editor.ComponentModel
|
|||
pos += 10;
|
||||
break;
|
||||
}
|
||||
else if ((pos + 24 < length) && frag.Substring (pos + 1, 24) == "!--<directiveplaceholder") {
|
||||
else if ((pos + 20 < length) && frag.Substring (pos + 1, 20) == "directiveplaceholder") {
|
||||
mode = SMode.DirectiveId;
|
||||
pos += 24;
|
||||
pos += 20;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ namespace AspNetEdit.Editor.ComponentModel
|
|||
if (c == 'i' && (pos + 4 < length) && frag.Substring (pos, 4) == "id=\"") {
|
||||
int idEnd = frag.IndexOf ('"', pos + 4 + 1);
|
||||
if (idEnd == -1) throw new Exception ("Identifier was unterminated");
|
||||
int id = System.Convert.ToInt32 (frag.Substring (pos + 4 + 1, (idEnd - pos - 4)));
|
||||
int id = Int32.Parse (frag.Substring (pos + 4, (idEnd - pos - 4)));
|
||||
|
||||
//TODO: more intelligent removal/copying of directives in case of fragments
|
||||
//works fine with whole document.
|
||||
|
@ -212,8 +212,7 @@ namespace AspNetEdit.Editor.ComponentModel
|
|||
if (c == 'i' && (pos + 4 < length) && frag.Substring (pos, 4) == "id=\"") {
|
||||
int idEnd = frag.IndexOf("\"", pos + 4);
|
||||
if (idEnd == -1) throw new Exception ("Identifier was unterminated");
|
||||
string id = frag.Substring (pos + 4, (idEnd - pos - 4));
|
||||
System.Diagnostics.Trace.WriteLine ("Persisting control with id: " + id);
|
||||
string id = frag.Substring (pos + 4, (idEnd - pos - 4));
|
||||
|
||||
DesignContainer dc = (DesignContainer) host.Container;
|
||||
Control control = dc.GetComponent (id) as Control;
|
||||
|
@ -235,7 +234,10 @@ namespace AspNetEdit.Editor.ComponentModel
|
|||
|
||||
//it's found the placeholder's ID and is looking for the end
|
||||
case SMode.DirectiveEnd:
|
||||
mode = SMode.Free;
|
||||
if (c == '/' && (pos + 2 < length) && frag.Substring (pos, 2) == "/>") {
|
||||
pos += 1;
|
||||
mode = SMode.Free;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -263,9 +263,7 @@ namespace AspNetEdit.Editor.Persistence
|
|||
|
||||
PersistenceModeAttribute modeAttrib = prop.Attributes[typeof(PersistenceModeAttribute)] as PersistenceModeAttribute;
|
||||
if (modeAttrib == null || modeAttrib.Mode == PersistenceMode.Attribute)
|
||||
continue;
|
||||
|
||||
Console.WriteLine ("Prop: "+prop.Name+"PersistenceMode:"+modeAttrib.Mode.ToString());
|
||||
continue;
|
||||
|
||||
//handle the different modes
|
||||
switch (modeAttrib.Mode)
|
||||
|
|
|
@ -163,7 +163,7 @@ namespace AspNetEdit.Editor.UI
|
|||
internal void InsertFragment (string fragment)
|
||||
{
|
||||
System.Diagnostics.Trace.WriteLine ("Inserting document fragment: " + fragment);
|
||||
comm.JSCall (GeckoFunctions.InsertFragment, null, fragment);
|
||||
comm.JSCall (GeckoFunctions.InsertFragment, null, host.RootDocument.Serialize (fragment));
|
||||
}
|
||||
|
||||
internal void AddControl(Control control)
|
||||
|
@ -479,7 +479,7 @@ namespace AspNetEdit.Editor.UI
|
|||
public static readonly string DoCommand = "DoCommand";
|
||||
|
||||
///<summary>
|
||||
/// Inserts a document fragment. May contain HTML or ASP.NET; document should call host to deserialise it.
|
||||
/// Inserts a document fragment. Host should have deserialised it.
|
||||
/// Args:
|
||||
/// string fragment: The document fragment
|
||||
/// Returns: none
|
||||
|
|
Загрузка…
Ссылка в новой задаче