微信小程序编译
All checks were successful
Plugin Library CI / publish (00.BuildOriginality) (push) Successful in 13s
Plugin Library CI / publish (00.StaryEvo) (push) Successful in 17s
Plugin Library CI / publish (00.StaryEvoTools) (push) Successful in 35s
Plugin Library CI / publish (01.HybridCLR) (push) Successful in 15s
Plugin Library CI / publish (02.InformationSave) (push) Successful in 3s
Plugin Library CI / publish (03.YooAsset) (push) Successful in 33s
Plugin Library CI / publish (04.AudioCore) (push) Successful in 3s
Plugin Library CI / publish (05.TableTextConversion) (push) Successful in 5s
Plugin Library CI / publish (06.UIFarme) (push) Successful in 15s
Plugin Library CI / publish (07.RKTools) (push) Successful in 2s
Plugin Library CI / publish (08.UniTask) (push) Successful in 3s
Plugin Library CI / publish (09.CodeChecker) (push) Successful in 16s
Plugin Library CI / publish (10.StoryEditor) (push) Successful in 3s
Plugin Library CI / publish (10.XNode) (push) Successful in 3s
Plugin Library CI / publish (11.PointCloudTools) (push) Successful in 2s
Plugin Library CI / publish (12.WeixinMinigame) (push) Successful in 2m32s
All checks were successful
Plugin Library CI / publish (00.BuildOriginality) (push) Successful in 13s
Plugin Library CI / publish (00.StaryEvo) (push) Successful in 17s
Plugin Library CI / publish (00.StaryEvoTools) (push) Successful in 35s
Plugin Library CI / publish (01.HybridCLR) (push) Successful in 15s
Plugin Library CI / publish (02.InformationSave) (push) Successful in 3s
Plugin Library CI / publish (03.YooAsset) (push) Successful in 33s
Plugin Library CI / publish (04.AudioCore) (push) Successful in 3s
Plugin Library CI / publish (05.TableTextConversion) (push) Successful in 5s
Plugin Library CI / publish (06.UIFarme) (push) Successful in 15s
Plugin Library CI / publish (07.RKTools) (push) Successful in 2s
Plugin Library CI / publish (08.UniTask) (push) Successful in 3s
Plugin Library CI / publish (09.CodeChecker) (push) Successful in 16s
Plugin Library CI / publish (10.StoryEditor) (push) Successful in 3s
Plugin Library CI / publish (10.XNode) (push) Successful in 3s
Plugin Library CI / publish (11.PointCloudTools) (push) Successful in 2s
Plugin Library CI / publish (12.WeixinMinigame) (push) Successful in 2m32s
This commit is contained in:
@@ -0,0 +1,137 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
let FrameworkData = null;
|
||||
const keyboardSetting = {
|
||||
value: '',
|
||||
maxLength: 140,
|
||||
multiple: false,
|
||||
confirmHold: false,
|
||||
confirmType: 'done',
|
||||
};
|
||||
const keyboardInputlistener = function (res) {
|
||||
keyboardSetting.value = res.value;
|
||||
};
|
||||
const keyboardConfirmlistener = function (res) {
|
||||
keyboardSetting.value = res.value;
|
||||
_JS_MobileKeyboard_Hide(false);
|
||||
};
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const keyboardCompletelistener = function (res) {
|
||||
removeKeyboardListeners();
|
||||
};
|
||||
let hasExistingMobileInput = false;
|
||||
let mobile_input_hide_delay = null;
|
||||
let mobile_input_ignore_blur_event = false;
|
||||
function _JS_MobileKeybard_GetIgnoreBlurEvent() {
|
||||
|
||||
|
||||
|
||||
return mobile_input_ignore_blur_event;
|
||||
}
|
||||
function _JS_MobileKeyboard_GetKeyboardStatus() {
|
||||
const kKeyboardStatusVisible = 0;
|
||||
const kKeyboardStatusDone = 1;
|
||||
|
||||
|
||||
if (!hasExistingMobileInput) {
|
||||
return kKeyboardStatusDone;
|
||||
}
|
||||
return kKeyboardStatusVisible;
|
||||
}
|
||||
function _JS_MobileKeyboard_GetText(buffer, bufferSize) {
|
||||
if (buffer) {
|
||||
FrameworkData.stringToUTF8(keyboardSetting.value, buffer, bufferSize);
|
||||
}
|
||||
return FrameworkData.lengthBytesUTF8(keyboardSetting.value);
|
||||
}
|
||||
function _JS_MobileKeyboard_GetTextSelection(outStart, outLength) {
|
||||
|
||||
const n = keyboardSetting.value.length;
|
||||
FrameworkData.HEAP32[outStart >> 2] = n;
|
||||
FrameworkData.HEAP32[outLength >> 2] = 0;
|
||||
}
|
||||
function _JS_MobileKeyboard_Hide(delay) {
|
||||
if (mobile_input_hide_delay) {
|
||||
return;
|
||||
}
|
||||
mobile_input_ignore_blur_event = true;
|
||||
function hideMobileKeyboard() {
|
||||
if (hasExistingMobileInput) {
|
||||
wx.hideKeyboard();
|
||||
}
|
||||
hasExistingMobileInput = false;
|
||||
mobile_input_hide_delay = null;
|
||||
|
||||
|
||||
|
||||
|
||||
setTimeout(() => {
|
||||
mobile_input_ignore_blur_event = false;
|
||||
}, 100);
|
||||
}
|
||||
if (delay) {
|
||||
|
||||
|
||||
|
||||
|
||||
const hideDelay = 200;
|
||||
mobile_input_hide_delay = setTimeout(hideMobileKeyboard, hideDelay);
|
||||
}
|
||||
else {
|
||||
hideMobileKeyboard();
|
||||
}
|
||||
}
|
||||
function _JS_MobileKeyboard_SetCharacterLimit(limit) {
|
||||
keyboardSetting.maxLength = limit;
|
||||
}
|
||||
function _JS_MobileKeyboard_SetText(text) {
|
||||
if (!hasExistingMobileInput) {
|
||||
return;
|
||||
}
|
||||
keyboardSetting.value = FrameworkData.UTF8ToString(text);
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
function _JS_MobileKeyboard_SetTextSelection(start, length) {
|
||||
|
||||
}
|
||||
function _JS_MobileKeyboard_Show(text, keyboardType, autocorrection, multiline, secure, alert, placeholder, characterLimit, data) {
|
||||
if (FrameworkData === null) {
|
||||
FrameworkData = data;
|
||||
}
|
||||
if (mobile_input_hide_delay) {
|
||||
clearTimeout(mobile_input_hide_delay);
|
||||
mobile_input_hide_delay = null;
|
||||
}
|
||||
if (hasExistingMobileInput) {
|
||||
if (keyboardSetting.multiple !== !!multiline) {
|
||||
_JS_MobileKeyboard_Hide(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
keyboardSetting.value = FrameworkData.UTF8ToString(text);
|
||||
keyboardSetting.maxLength = characterLimit > 0 ? characterLimit : 524288;
|
||||
keyboardSetting.multiple = !!multiline;
|
||||
wx.showKeyboard({ defaultValue: keyboardSetting.value, maxLength: keyboardSetting.maxLength, multiple: keyboardSetting.multiple, confirmHold: keyboardSetting.confirmHold, confirmType: keyboardSetting.confirmType });
|
||||
addKeyboardListeners();
|
||||
hasExistingMobileInput = true;
|
||||
}
|
||||
function addKeyboardListeners() {
|
||||
wx.onKeyboardInput(keyboardInputlistener);
|
||||
wx.onKeyboardConfirm(keyboardConfirmlistener);
|
||||
wx.onKeyboardComplete(keyboardCompletelistener);
|
||||
}
|
||||
function removeKeyboardListeners() {
|
||||
wx.offKeyboardInput(keyboardInputlistener);
|
||||
wx.offKeyboardConfirm(keyboardConfirmlistener);
|
||||
wx.offKeyboardComplete(keyboardCompletelistener);
|
||||
}
|
||||
export default {
|
||||
_JS_MobileKeybard_GetIgnoreBlurEvent,
|
||||
_JS_MobileKeyboard_GetKeyboardStatus,
|
||||
_JS_MobileKeyboard_GetText,
|
||||
_JS_MobileKeyboard_GetTextSelection,
|
||||
_JS_MobileKeyboard_Hide,
|
||||
_JS_MobileKeyboard_SetCharacterLimit,
|
||||
_JS_MobileKeyboard_SetText,
|
||||
_JS_MobileKeyboard_SetTextSelection,
|
||||
_JS_MobileKeyboard_Show,
|
||||
};
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e8b26b4ff3d6c634899909b1deda389b
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user