|
@@ -896,6 +896,8 @@ Type
|
|
procedure SetTextMode(AValue: TTextMode);
|
|
procedure SetTextMode(AValue: TTextMode);
|
|
Protected
|
|
Protected
|
|
Procedure ApplyWidgetSettings(aElement: TJSHTMLElement); override;
|
|
Procedure ApplyWidgetSettings(aElement: TJSHTMLElement); override;
|
|
|
|
+ // Apply TextContent to aElement, ignore empty unless forceEmpty is true.
|
|
|
|
+ procedure ApplyText(aElement: TJSHTMLElement; aForceEmpty: Boolean);
|
|
Function HTMLTag : String; override;
|
|
Function HTMLTag : String; override;
|
|
// Set tag you wish to use
|
|
// Set tag you wish to use
|
|
Property elementTag : THTMLElementTag Read FElementTag Write SetElementTag;
|
|
Property elementTag : THTMLElementTag Read FElementTag Write SetElementTag;
|
|
@@ -903,6 +905,9 @@ Type
|
|
Property TextContent : String Read FTextContent Write SetTextContent;
|
|
Property TextContent : String Read FTextContent Write SetTextContent;
|
|
// Use InnerHTML or InnerText when setting TextContent
|
|
// Use InnerHTML or InnerText when setting TextContent
|
|
Property TextMode : TTextMode Read FTextMode Write SetTextMode;
|
|
Property TextMode : TTextMode Read FTextMode Write SetTextMode;
|
|
|
|
+ Public
|
|
|
|
+ Procedure ClearContent; override;
|
|
|
|
+
|
|
end;
|
|
end;
|
|
|
|
|
|
{ TTagWidget }
|
|
{ TTagWidget }
|
|
@@ -3177,12 +3182,28 @@ begin
|
|
Refresh;
|
|
Refresh;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+procedure TCustomTagWidget.ApplyText(aElement : TJSHTMLElement; aForceEmpty : Boolean);
|
|
|
|
+
|
|
|
|
+begin
|
|
|
|
+ if Not Assigned(aElement) then
|
|
|
|
+ exit;
|
|
|
|
+ if (TextContent<>'') or aForceEmpty then
|
|
|
|
+ if TextMode=tmText then
|
|
|
|
+ aElement.InnerText:=TextContent
|
|
|
|
+ else
|
|
|
|
+ aElement.InnerHTML:=TextContent
|
|
|
|
+end;
|
|
|
|
+
|
|
procedure TCustomTagWidget.SetTextContent(AValue: String);
|
|
procedure TCustomTagWidget.SetTextContent(AValue: String);
|
|
begin
|
|
begin
|
|
if FTextContent=AValue then Exit;
|
|
if FTextContent=AValue then Exit;
|
|
FTextContent:=AValue;
|
|
FTextContent:=AValue;
|
|
if IsRendered then
|
|
if IsRendered then
|
|
|
|
+ begin
|
|
|
|
+ // ApplyWidgetSettings ignores empty text, so we must clear it here...
|
|
|
|
+ ApplyText(Element,True);
|
|
Refresh;
|
|
Refresh;
|
|
|
|
+ end;
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure TCustomTagWidget.SetTextMode(AValue: TTextMode);
|
|
procedure TCustomTagWidget.SetTextMode(AValue: TTextMode);
|
|
@@ -3195,11 +3216,7 @@ end;
|
|
procedure TCustomTagWidget.ApplyWidgetSettings(aElement: TJSHTMLElement);
|
|
procedure TCustomTagWidget.ApplyWidgetSettings(aElement: TJSHTMLElement);
|
|
begin
|
|
begin
|
|
inherited ApplyWidgetSettings(aElement);
|
|
inherited ApplyWidgetSettings(aElement);
|
|
- if FTextContent<>'' then
|
|
|
|
- if TextMode=tmText then
|
|
|
|
- aElement.InnerText:=TextContent
|
|
|
|
- else
|
|
|
|
- aElement.InnerHTML:=TextContent
|
|
|
|
|
|
+ ApplyText(aElement,False);
|
|
end;
|
|
end;
|
|
|
|
|
|
function TCustomTagWidget.HTMLTag: String;
|
|
function TCustomTagWidget.HTMLTag: String;
|
|
@@ -3208,6 +3225,12 @@ begin
|
|
Result:=HTMLTagNames[ElementTag];
|
|
Result:=HTMLTagNames[ElementTag];
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+procedure TCustomTagWidget.ClearContent;
|
|
|
|
+begin
|
|
|
|
+ inherited ClearContent;
|
|
|
|
+ FTextContent:='';
|
|
|
|
+end;
|
|
|
|
+
|
|
{ TDivWidget }
|
|
{ TDivWidget }
|
|
|
|
|
|
|
|
|