IceCold
IceCold

Reputation: 21202

How to enable EditorMode in TChromium?

I would like to switch from TWebBrowser to DCEF3 (TChromium).
Can DCEF3 edit a HTML page? If yes, how to enable it to enter 'editor' mode?

Upvotes: 0

Views: 616

Answers (1)

RaelB
RaelB

Reputation: 3481

Since you can execute Javascript in Chromium, you can achieve anything that can be done in Javascript.

So you could use this:

procedure TMainForm.EditMode1Click(Sender: TObject);
begin
  if crm.Browser <> nil then
    crm.Browser.MainFrame.ExecuteJavaScript(
      'document.designMode = "on"', 'about:blank', 0);
end;

procedure TMainForm.EditModeOFF1Click(Sender: TObject);
begin
  if crm.Browser <> nil then
    crm.Browser.MainFrame.ExecuteJavaScript(
      'document.designMode = "off"', 'about:blank', 0);
end;

For more details, you should google how to use Javascript to make an (Simple) HTML Editor.

Upvotes: 1

Related Questions