/// <summary>input must be focused in order for createTextRange() to work ! </summary> /// <param name="self"></param> public static void SelectWholeTextAndMoveCursorToEnd(this Element self) { //original idea from https://css-tricks.com/snippets/javascript/move-cursor-to-end-of-input/ if (self.HasFieldOrMethod("selectionStart") && self.IsFieldReadable("selectionStart")) { var selectionStart = self.GetFieldValue("selectionStart"); if (Script.TypeOf(selectionStart) != "number") { return; } var len = self.GetFieldValue("value.length"); self.SetFieldValue("selectionStart", 0); self.SetFieldValue("selectionEnd", len); return; } var createTextRange = BridgeObjectUtil.GetFieldValue(self, "createTextRange"); if (BridgeObjectUtil.HasFieldOrMethod(self, "select")) { BridgeObjectUtil.CallMethodPlain(self, "select"); } if (Script.TypeOf(createTextRange) != "undefined") { var range = BridgeObjectUtil.CallSelf(createTextRange); BridgeObjectUtil.CallMethodPlain(range, "collapse", false); BridgeObjectUtil.CallMethodPlain(range, "select"); } }
public void requestScanQr(string webRequestId, bool askJsForValidation, LayoutStrategy layout) { var layoutAsJson = JsonConvert.SerializeObject(layout); BridgeObjectUtil.CallMethodPlain(_impl, nameof(requestScanQr), webRequestId, askJsForValidation ? BridgeObjectUtil.True : BridgeObjectUtil.False, layoutAsJson); }
public void setToolbarSearchState(bool v) { BridgeObjectUtil.CallMethodPlain(_impl, nameof(setToolbarSearchState), //avoid boxing v ? BridgeObjectUtil.True : BridgeObjectUtil.False); }
public void setToolbarItems(string menuItemInfosAsJson) { BridgeObjectUtil.CallMethodPlain(_impl, nameof(setToolbarItems), menuItemInfosAsJson); }
public void registerMediaAsset(string webRequestId, string fileContent) => BridgeObjectUtil.CallMethodPlain(_impl, nameof(registerMediaAsset), webRequestId, fileContent);
public void cancelScanQr(string webRequestId) => BridgeObjectUtil.CallMethodPlain(_impl, nameof(cancelScanQr), webRequestId);
public void setToolbarColors(string backgroundColor, string foregroundColor) { BridgeObjectUtil.CallMethodPlain(_impl, "setToolbarColors", backgroundColor, foregroundColor); }
public bool hasMediaAsset(string mediaAssetId) => (bool)BridgeObjectUtil.CallMethodPlain(_impl, nameof(hasMediaAsset), mediaAssetId);
public bool setPausedScanOverlayImage(string mediaAssetId) => (bool)BridgeObjectUtil.CallMethodPlain(_impl, nameof(setPausedScanOverlayImage), mediaAssetId);
public bool setScanSuccessSound(string mediaAssetId) => (bool)BridgeObjectUtil.CallMethodPlain(_impl, nameof(setScanSuccessSound), mediaAssetId);