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.SelectChannelUtils = BDFDB.WebModules.findByProperties('selectChannel', 'selectPrivateChannel');
|
||||||
LibraryModules.SettingsUtils = BDFDB.WebModules.findByProperties('updateRemoteSettings', 'updateLocalSettings');
|
LibraryModules.SettingsUtils = BDFDB.WebModules.findByProperties('updateRemoteSettings', 'updateLocalSettings');
|
||||||
LibraryModules.SoundUtils = BDFDB.WebModules.findByProperties('playSound', 'createSound');
|
LibraryModules.SoundUtils = BDFDB.WebModules.findByProperties('playSound', 'createSound');
|
||||||
|
LibraryModules.SpellCheckUtils = BDFDB.WebModules.findByProperties('learnWord', 'toggleSpellcheck');
|
||||||
LibraryModules.StatusMetaUtils = BDFDB.WebModules.findByProperties('getApplicationActivity', 'getStatus');
|
LibraryModules.StatusMetaUtils = BDFDB.WebModules.findByProperties('getApplicationActivity', 'getStatus');
|
||||||
LibraryModules.StreamingUtils = BDFDB.WebModules.findByProperties('isStreaming');
|
LibraryModules.StreamingUtils = BDFDB.WebModules.findByProperties('isStreaming');
|
||||||
LibraryModules.UnreadGuildUtils = BDFDB.WebModules.findByProperties('hasUnread', 'getUnreadGuilds');
|
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 => {
|
BDFDB.WebModules.patch(module.prototype, 'componentDidUpdate', BDFDB, {after: e => {
|
||||||
var menu = BDFDB.React.findDOMNodeSafe(e.thisObject);
|
var menu = BDFDB.React.findDOMNodeSafe(e.thisObject);
|
||||||
if (menu) {
|
if (menu) {
|
||||||
BDFDB.initElements(menu);
|
|
||||||
const updater = BDFDB.getReactValue(e, 'thisObject._reactInternalFiber.stateNode.props.onHeightUpdate');
|
const updater = BDFDB.getReactValue(e, 'thisObject._reactInternalFiber.stateNode.props.onHeightUpdate');
|
||||||
const mrects = BDFDB.getRects(menu), arects = BDFDB.getRects(document.querySelector(BDFDB.dotCN.appmount));
|
const mrects = BDFDB.getRects(menu), arects = BDFDB.getRects(document.querySelector(BDFDB.dotCN.appmount));
|
||||||
if (updater && (mrects.top + mrects.height > arects.height)) updater();
|
if (updater && (mrects.top + mrects.height > arects.height)) updater();
|
||||||
|
@ -6355,6 +6355,12 @@ var BDFDB = {myPlugins: BDFDB && BDFDB.myPlugins ? BDFDB.myPlugins : {}, BDv2Api
|
||||||
|
|
||||||
BDFDB.addContextListener(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;
|
BDFDB.loaded = true;
|
||||||
var reloadLib = function () {
|
var reloadLib = function () {
|
||||||
var libraryScript = document.querySelector('head script#BDFDBLibraryScript');
|
var libraryScript = document.querySelector('head script#BDFDBLibraryScript');
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
class SpellCheck {
|
class SpellCheck {
|
||||||
getName () {return "SpellCheck";}
|
getName () {return "SpellCheck";}
|
||||||
|
|
||||||
getVersion () {return "1.3.6";}
|
getVersion () {return "1.3.8";}
|
||||||
|
|
||||||
getAuthor () {return "DevilBro";}
|
getAuthor () {return "DevilBro";}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ class SpellCheck {
|
||||||
|
|
||||||
constructor () {
|
constructor () {
|
||||||
this.changelog = {
|
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 = {
|
this.patchModules = {
|
||||||
|
@ -154,9 +154,19 @@ class SpellCheck {
|
||||||
// begin of own functions
|
// begin of own functions
|
||||||
|
|
||||||
onNativeContextMenu (instance, menu, returnvalue) {
|
onNativeContextMenu (instance, menu, returnvalue) {
|
||||||
if (instance.props && instance.props.target && instance.props.type == "CHANNEL_TEXT_AREA" && !menu.querySelector(`${this.name}-contextMenuItem`)) {
|
if (instance.props && instance.props.target && instance.props.target.tagName == "TEXTAREA" && !menu.querySelector(`${this.name}-contextMenuItem`)) {
|
||||||
BDFDB.toggleEles(BDFDB.React.findDOMNodeSafe(BDFDB.getOwnerInstance({node:menu, name:"NativeSpellcheckGroup"})), false);
|
let [SCparent, SCindex] = BDFDB.getContextMenuGroupAndIndex(returnvalue, ["NativeSpellcheckGroup", "FluxContainer(NativeSpellcheckGroup)"]);
|
||||||
var textarea = instance.props.target, word = null, length = 0;
|
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)) {
|
if (textarea.value && (textarea.selectionStart || textarea.selectionEnd)) for (let splitword of textarea.value.split(/\s/g)) {
|
||||||
length += splitword.length + 1;
|
length += splitword.length + 1;
|
||||||
if (length > textarea.selectionStart) {
|
if (length > textarea.selectionStart) {
|
||||||
|
@ -190,7 +200,10 @@ class SpellCheck {
|
||||||
}));
|
}));
|
||||||
const itemgroup = BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
|
const itemgroup = BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
|
||||||
className: `BDFDB-contextMenuItemGroup ${this.name}-contextMenuItemGroup`,
|
className: `BDFDB-contextMenuItemGroup ${this.name}-contextMenuItemGroup`,
|
||||||
children: [
|
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, {
|
BDFDB.React.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||||
label: this.labels.context_spellcheck_text,
|
label: this.labels.context_spellcheck_text,
|
||||||
hint: word,
|
hint: word,
|
||||||
|
@ -206,6 +219,7 @@ class SpellCheck {
|
||||||
render: items
|
render: items
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
|
})
|
||||||
});
|
});
|
||||||
if (index > -1) children.splice(index, 0, itemgroup);
|
if (index > -1) children.splice(index, 0, itemgroup);
|
||||||
else children.push(itemgroup);
|
else children.push(itemgroup);
|
||||||
|
|
Loading…
Reference in New Issue