public override void AwakeFromNib() { XcbWebView = new XcbWebView(this); UIDelegate = new XIWebUIDelegate(); PolicyDelegate = new XIWebPolicyDelegate(); RegisterViewClass <XIMapViewWebDocumentView, XIMapViewWebDocumentRepresentation> ( "application/x-inspector-map-view"); if (WebKitPrefs.DeveloperExtrasEnabled) { using (NativeExceptionHandler.Trap()) { try { WebInspector = this.GetInspector(); } catch (Exception e) { Log.Error(TAG, "private WebKit API may have been removed", e); } } switch (Prefs.Developer.StartupWebInspectorPane.GetValue()) { case Prefs.Developer.WebInspectorPane.Console: WebInspector?.ShowConsole(this); break; case Prefs.Developer.WebInspectorPane.ElementTree: WebInspector?.Show(this); break; } } }
public XcbWorkbookPageView( XcbWebView webView, ClientSession clientSession, WorkbookPage workbookPage) : base(clientSession, workbookPage) { this.webView = webView ?? throw new ArgumentNullException(nameof(webView)); void ObserveWorkbookMutationModelChanges(dynamic self, dynamic args) => TableOfContentsNodeExtensions.RebuildFromJavaScript(workbookPage.TableOfContents, args [0]); webView.Document.Context.GlobalObject.xiexports.WorkbookMutationObserver.observeModelChanges( (ScriptAction)ObserveWorkbookMutationModelChanges); rendererContext = new RendererContext(clientSession, webView.Document); rendererContext.MemberReferenceRequested += OnRendererContextMemberReferenceRequested; rendererContext.AsyncRenderComplete += (sender, e) => { var view = focusedCellState?.View; // Image rendering can happen asynchronously. If the last cell is evaluated, and // the focus has shifted to a new last cell, make sure the new last cell's // input doesn't get pushed out of the view by the image load. if (view != null && focusedWorkbookCell != null && focusedWorkbookCell.NextCell == null) { SynchronizationContext.Current.Post(o => view.Focus(), null); } }; clientSession.Workbook.EditorHub.Events.Subscribe( new Observer <EditorEvent> (HandleEditorEvent)); var document = webView.Document; xiexports = document.Context.GlobalObject.xiexports; outputElement = document.CreateElement("main"); outputElement.AddCssClass("interactive-workspace"); outputElement.AddCssClass(HostEnvironment.OS == HostOS.macOS ? "is-mac" : "is-windows"); outputElement.AddCssClass( $"session-kind-{clientSession.SessionKind.ToString ().ToLowerInvariant ()}"); document.Body.AppendChild(outputElement); AppendFirstCellActions(outputElement); }
public WorkbookWebPageViewHost(XcbWebView webView) => this.webView = webView