This commit is contained in:
Mirco Wittrien 2022-04-01 00:52:01 +02:00
parent d4af867f3f
commit 09194d6545
7 changed files with 35 additions and 44 deletions

View File

@ -2,7 +2,7 @@
* @name BDFDB
* @author DevilBro
* @authorId 278543574059057154
* @version 2.2.4
* @version 2.2.5
* @description Required Library for DevilBro's Plugins
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -19,14 +19,8 @@ module.exports = (_ => {
"info": {
"name": "BDFDB",
"author": "DevilBro",
"version": "2.2.4",
"version": "2.2.5",
"description": "Required Library for DevilBro's Plugins"
},
"rawUrl": `https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js`,
"changeLog": {
"improved": {
"Toast Performance": "Increased Performance, by switching to css animation instead of discord internal animations"
}
}
};
@ -4233,17 +4227,13 @@ module.exports = (_ => {
BDFDB.SlateUtils = {};
BDFDB.SlateUtils.isRichValue = function (richValue) {
return BDFDB.ObjectUtils.is(richValue) && Internal.LibraryModules.SlateUtils.deserialize("").constructor.prototype.isPrototypeOf(richValue);
return richValue && typeof richValue == "object" && BDFDB.SlateUtils.toRichValue("").constructor.prototype.isPrototypeOf(richValue);
};
BDFDB.SlateUtils.copyRichValue = function (string, richValue) {
let newRichValue = Internal.LibraryModules.SlateUtils.deserialize(string);
if (BDFDB.SlateUtils.isRichValue(richValue) && richValue._map && richValue._map._root && BDFDB.ArrayUtils.is(richValue._map._root.entries)) {
for (let i in richValue._map._root.entries) if (richValue._map._root.entries[i][0] == "selection") {
newRichValue._map._root.entries[i] = richValue._map._root.entries[i];
break;
}
}
return newRichValue;
BDFDB.SlateUtils.toTextValue = function (richValue) {
return BDFDB.SlateUtils.isRichValue(richValue) ? Internal.LibraryModules.SlateTextUtils.toTextValue(richValue) : "";
};
BDFDB.SlateUtils.toRichValue = function (string) {
return typeof string == "string" ? Internal.LibraryModules.SlateRichUtils.toRichValue(string) : null;
};
BDFDB.NumberUtils = {};

View File

@ -115,7 +115,9 @@
"SettingsUtilsOld": {"props": ["updateLocalSettings", "updateRemoteSettings"]},
"SimpleMarkdownComponents": {"strings": ["customEmoji", "emojiTooltipPosition", "timestampTooltip"]},
"SimpleMarkdownParser": {"props": ["parseBlock", "parseInline", "defaultOutput"]},
"SlateUtils": {"props": ["serialize", "deserialize"], "nonProps": ["getFlag"]},
"SlateDraftUtils": {"props": ["getRecentlyEditedDrafts", "getDraft"]},
"SlateRichUtils": {"props": ["toRichValue", "createEmptyState"]},
"SlateTextUtils": {"props": ["toTextValue", "serializeDescendant"]},
"SlateSelectionUtils": {"props": ["serialize", "serializeSelection"]},
"SlowmodeUtils": {"props": ["getSlowmodeCooldownGuess"]},
"SoundParser": {"strings": ["discodo", "ddr-down", "mute"]},

View File

@ -2,7 +2,7 @@
* @name ChatAliases
* @author DevilBro
* @authorId 278543574059057154
* @version 2.3.3
* @version 2.3.4
* @description Allows you to configure your own Aliases/Commands
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -17,13 +17,8 @@ module.exports = (_ => {
"info": {
"name": "ChatAliases",
"author": "DevilBro",
"version": "2.3.3",
"version": "2.3.4",
"description": "Allows you to configure your own Aliases/Commands"
},
"changeLog": {
"improved": {
"Threads": "Works flawlessly with Threads now"
}
}
};
@ -406,10 +401,10 @@ module.exports = (_ => {
if (messageData.text != null && e2.methodArguments[textIndex] != messageData.text) {
e2.methodArguments[textIndex] = messageData.text;
e.instance.props.textValue = "";
if (e.instance.props.richValue) e.instance.props.richValue = BDFDB.SlateUtils.copyRichValue("", e.instance.props.richValue);
if (e.instance.props.richValue) e.instance.props.richValue = BDFDB.SlateUtils.toRichValue("");
if (e.instance.state) {
e.instance.state.textValue = "";
if (e.instance.state.richValue) e.instance.state.richValue = BDFDB.SlateUtils.copyRichValue("", e.instance.state.richValue);
if (e.instance.state.richValue) e.instance.state.richValue = BDFDB.SlateUtils.toRichValue("");
}
BDFDB.ReactUtils.forceUpdate(e.instance);
}

View File

@ -2,7 +2,7 @@
* @name MessageUtilities
* @author DevilBro
* @authorId 278543574059057154
* @version 1.9.2
* @version 1.9.3
* @description Adds several Quick Actions for Messages (Delete, Edit, Pin, etc.)
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -17,7 +17,7 @@ module.exports = (_ => {
"info": {
"name": "MessageUtilities",
"author": "DevilBro",
"version": "1.9.2",
"version": "1.9.3",
"description": "Adds several Quick Actions for Messages (Delete, Edit, Pin, etc.)"
}
};
@ -335,7 +335,7 @@ module.exports = (_ => {
let type = event.type;
if (!firedEvents.includes(type)) {
if (event.which == 27 && settings.clearOnEscape && ChannelTextAreaForm) {
ChannelTextAreaForm.setState({textValue: "", richValue: BDFDB.LibraryModules.SlateUtils.deserialize("")});
ChannelTextAreaForm.setState({textValue: "", richValue: BDFDB.SlateUtils.toRichValue("")});
}
BDFDB.TimeUtils.timeout(_ => {BDFDB.ArrayUtils.remove(firedEvents, type, true)});
}

View File

@ -2,7 +2,7 @@
* @name SpellCheck
* @author DevilBro
* @authorId 278543574059057154
* @version 1.5.8
* @version 1.5.9
* @description Adds a Spell Check to all Message Inputs. Select a Word and Right Click it to add it to your Dictionary
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -17,7 +17,7 @@ module.exports = (_ => {
"info": {
"name": "SpellCheck",
"author": "DevilBro",
"version": "1.5.8",
"version": "1.5.9",
"description": "Adds a Spell Check to all Message Inputs. Select a Word and Right Click it to add it to your Dictionary"
}
};
@ -249,7 +249,7 @@ module.exports = (_ => {
}
processSlateChannelTextArea (e) {
let newText = BDFDB.LibraryModules.SlateUtils.serialize(e.instance.props.value);
let newText = BDFDB.SlateUtils.toTextValue(e.instance.props.value);
if (newText != currentText) {
currentText = newText;
BDFDB.DOMUtils.remove(e.node.parentElement.querySelectorAll(BDFDB.dotCN._spellcheckoverlay));
@ -314,7 +314,7 @@ module.exports = (_ => {
}
else newString.push(word + (hasNewline ? "\n" : ""));
});
editor.setValue(BDFDB.SlateUtils.copyRichValue(newString.join(" ").replace(/\n /g, "\n"), editor.props.value));
editor.setValue(BDFDB.SlateUtils.toRichValue(newString.join(" ").replace(/\n /g, "\n")));
}
addToOwnDictionary (word) {

View File

@ -2,7 +2,7 @@
* @name WriteUpperCase
* @author DevilBro
* @authorId 278543574059057154
* @version 1.3.4
* @version 1.3.5
* @description Changes the first Letter of each Sentence in Message Inputs to Uppercase
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -17,13 +17,8 @@ module.exports = (_ => {
"info": {
"name": "WriteUpperCase",
"author": "DevilBro",
"version": "1.3.4",
"version": "1.3.5",
"description": "Changes the first Letter of each Sentence in Message Inputs to Uppercase"
},
"changeLog": {
"added": {
"QuickMessage": "Now also works for the quick message input in the user popout"
}
}
};
@ -178,8 +173,16 @@ module.exports = (_ => {
let string = e.instance.props.textValue;
let newString = this.parse(string);
if (string != newString) {
e.instance.props.textValue = newString;
if (e.instance.props.richValue) e.instance.props.richValue = BDFDB.SlateUtils.copyRichValue(newString, e.instance.props.richValue);
let selection = document.getSelection();
let container = selection.anchorNode && BDFDB.DOMUtils.getParent("[contenteditable]", selection.anchorNode.parentElement);
if (container && Array.from(container.children).findIndex(n => n && n.contains(selection.anchorNode)) == (container.childElementCount - 1)) {
selection.modify("extend", "backward", "paragraphboundary");
if (selection.toString().length == selection.anchorNode.textContent.length) {
e.instance.props.textValue = newString;
if (e.instance.props.richValue) e.instance.props.richValue = BDFDB.SlateUtils.toRichValue(newString);
}
selection.collapseToEnd();
}
}
}
}

View File

@ -87,6 +87,7 @@
--focus-primary: rgb(var(--linkcolor));
--guild-header-text-shadow: 0 1px 1px rgba(var(--backgroundfloating),.5);
--channeltextarea-background: rgba(var(--backgroundaccent),.8);
--input-background: rgba(0,0,0,.1);
--activity-card-background: rgb(var(--backgroundtertiary));
--textbox-markdown-syntax: rgb(var(--textdark));
--deprecated-card-bg: rgba(var(--backgroundtertiary),.6);