stuff
This commit is contained in:
parent
3d03620dc5
commit
f9983a7a78
File diff suppressed because one or more lines are too long
|
@ -1324,6 +1324,7 @@ var BDFDB = {myPlugins: BDFDB && BDFDB.myPlugins ? BDFDB.myPlugins : {}, BDv2Api
|
|||
LibraryModules.SelectChannelUtils = BDFDB.WebModules.findByProperties('selectChannel', 'selectPrivateChannel');
|
||||
LibraryModules.SettingsUtils = BDFDB.WebModules.findByProperties('updateRemoteSettings', 'updateLocalSettings');
|
||||
LibraryModules.SoundUtils = BDFDB.WebModules.findByProperties('playSound', 'createSound');
|
||||
LibraryModules.SpellCheckUtils = BDFDB.WebModules.findByProperties('learnWord', 'toggleSpellcheck');
|
||||
LibraryModules.StatusMetaUtils = BDFDB.WebModules.findByProperties('getApplicationActivity', 'getStatus');
|
||||
LibraryModules.StreamingUtils = BDFDB.WebModules.findByProperties('isStreaming');
|
||||
LibraryModules.UnreadGuildUtils = BDFDB.WebModules.findByProperties('hasUnread', 'getUnreadGuilds');
|
||||
|
@ -1642,7 +1643,6 @@ var BDFDB = {myPlugins: BDFDB && BDFDB.myPlugins ? BDFDB.myPlugins : {}, BDv2Api
|
|||
BDFDB.WebModules.patch(module.prototype, 'componentDidUpdate', BDFDB, {after: e => {
|
||||
var menu = BDFDB.React.findDOMNodeSafe(e.thisObject);
|
||||
if (menu) {
|
||||
BDFDB.initElements(menu);
|
||||
const updater = BDFDB.getReactValue(e, 'thisObject._reactInternalFiber.stateNode.props.onHeightUpdate');
|
||||
const mrects = BDFDB.getRects(menu), arects = BDFDB.getRects(document.querySelector(BDFDB.dotCN.appmount));
|
||||
if (updater && (mrects.top + mrects.height > arects.height)) updater();
|
||||
|
@ -6354,6 +6354,12 @@ var BDFDB = {myPlugins: BDFDB && BDFDB.myPlugins ? BDFDB.myPlugins : {}, BDv2Api
|
|||
BDFDB.WebModules.forceAllUpdates(BDFDB);
|
||||
|
||||
BDFDB.addContextListener(BDFDB);
|
||||
|
||||
BDFDB.addObserver(BDFDB, document.querySelector(BDFDB.dotCN.itemlayerconainer), {name:"layerObserverBDFDB", instance:
|
||||
new MutationObserver(changes => {changes.forEach(change => {change.addedNodes.forEach(node => {
|
||||
if (node.tagName && (BDFDB.containsClass(node, BDFDB.disCN.contextmenu) || (node = node.querySelector(BDFDB.dotCN.contextmenu)) != null)) BDFDB.initElements(node);
|
||||
})})})
|
||||
}, {childList: true});
|
||||
|
||||
BDFDB.loaded = true;
|
||||
var reloadLib = function () {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class SpellCheck {
|
||||
getName () {return "SpellCheck";}
|
||||
|
||||
getVersion () {return "1.3.6";}
|
||||
getVersion () {return "1.3.8";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class SpellCheck {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
"fixed":[["Edit Textarea","Contextmenu now properly works in all textareas, like the edit message box"]]
|
||||
};
|
||||
|
||||
this.patchModules = {
|
||||
|
@ -154,9 +154,19 @@ class SpellCheck {
|
|||
// begin of own functions
|
||||
|
||||
onNativeContextMenu (instance, menu, returnvalue) {
|
||||
if (instance.props && instance.props.target && instance.props.type == "CHANNEL_TEXT_AREA" && !menu.querySelector(`${this.name}-contextMenuItem`)) {
|
||||
BDFDB.toggleEles(BDFDB.React.findDOMNodeSafe(BDFDB.getOwnerInstance({node:menu, name:"NativeSpellcheckGroup"})), false);
|
||||
var textarea = instance.props.target, word = null, length = 0;
|
||||
if (instance.props && instance.props.target && instance.props.target.tagName == "TEXTAREA" && !menu.querySelector(`${this.name}-contextMenuItem`)) {
|
||||
let [SCparent, SCindex] = BDFDB.getContextMenuGroupAndIndex(returnvalue, ["NativeSpellcheckGroup", "FluxContainer(NativeSpellcheckGroup)"]);
|
||||
if (SCindex > -1) {
|
||||
if (BDFDB.getKeyInformation({instance:instance._reactInternalFiber, key:"spellcheckEnabled"}) == true) {
|
||||
clearTimeout(this.disableSpellcheckTimeout);
|
||||
this.disableSpellcheckTimeout = setTimeout(() => {
|
||||
BDFDB.LibraryModules.SpellCheckUtils.toggleSpellcheck();
|
||||
delete this.disableSpellcheckTimeout;
|
||||
}, 1000);
|
||||
}
|
||||
SCparent.splice(SCindex, 1);
|
||||
}
|
||||
let textarea = instance.props.target, word = null, length = 0;
|
||||
if (textarea.value && (textarea.selectionStart || textarea.selectionEnd)) for (let splitword of textarea.value.split(/\s/g)) {
|
||||
length += splitword.length + 1;
|
||||
if (length > textarea.selectionStart) {
|
||||
|
@ -190,22 +200,26 @@ class SpellCheck {
|
|||
}));
|
||||
const itemgroup = BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
|
||||
className: `BDFDB-contextMenuItemGroup ${this.name}-contextMenuItemGroup`,
|
||||
children: [
|
||||
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: this.labels.context_spellcheck_text,
|
||||
hint: word,
|
||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-addword-contextMenuItem`,
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
this.addToOwnDictionary(word);
|
||||
}
|
||||
}),
|
||||
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuSubItem, {
|
||||
label: this.labels.context_similarwords_text,
|
||||
className: `BDFDB-contextMenuSubItem ${this.name}-contextMenuSubItem ${this.name}-suggestions-contextMenuSubItem`,
|
||||
render: items
|
||||
})
|
||||
]
|
||||
children: BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuSubItem, {
|
||||
label: BDFDB.LanguageStrings.SPELLCHECK,
|
||||
className: `BDFDB-contextMenuSubItem ${this.name}-contextMenuSubItem ${this.name}-spellcheck-contextMenuSubItem`,
|
||||
render: [
|
||||
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: this.labels.context_spellcheck_text,
|
||||
hint: word,
|
||||
className: `BDFDB-contextMenuItem ${this.name}-contextMenuItem ${this.name}-addword-contextMenuItem`,
|
||||
action: e => {
|
||||
BDFDB.closeContextMenu(menu);
|
||||
this.addToOwnDictionary(word);
|
||||
}
|
||||
}),
|
||||
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuSubItem, {
|
||||
label: this.labels.context_similarwords_text,
|
||||
className: `BDFDB-contextMenuSubItem ${this.name}-contextMenuSubItem ${this.name}-suggestions-contextMenuSubItem`,
|
||||
render: items
|
||||
})
|
||||
]
|
||||
})
|
||||
});
|
||||
if (index > -1) children.splice(index, 0, itemgroup);
|
||||
else children.push(itemgroup);
|
||||
|
|
Loading…
Reference in New Issue