decord/alpha/source/stores/EditMessageStore.tsx

135 lines
3.7 KiB
TypeScript
Raw Permalink Normal View History

2026-10-12 06:59:38 +00:00
// Module ID: 7369
// Function ID: 7370
// Name: EditMessageStore
2026-10-12 06:59:38 +00:00
// Dependencies: [5432, 2041, 7370, 7374, 504, 584, 2]
2026-07-20 16:05:17 +00:00
2026-10-12 06:59:38 +00:00
// Module 7369 (EditMessageStore)
2026-10-03 08:58:59 +00:00
import get_initializedDefault from "get initialized" /* 504 */;
import DispatcherDefault from "Dispatcher" /* 584 */;
2026-10-09 10:00:15 +00:00
import UserSettings from "UserSettings" /* 2041 */;
2026-10-12 06:59:38 +00:00
import MessageParserDefault from "MessageParser" /* 7370 */;
import SlateUtils from "SlateUtils" /* 7374 */;
2026-10-10 08:08:14 +00:00
import MessageStore from "MessageStore" /* 5432 */;
2026-10-03 08:58:59 +00:00
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
2026-10-03 08:58:59 +00:00
let closure_4, closure_5;
const React3 = {};
const hasOwnProperty = {};
const Store = get_initializedDefault.Store;
2026-07-29 08:29:29 +00:00
class EditMessageStore extends Store {
2026-10-03 08:58:59 +00:00
initialize() {
this.waitFor(MessageStore);
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
isEditing(arg0, arg1) {
let messageId;
if (closure_4[arg0] != null) {
messageId = tmp.messageId;
}
return messageId === arg1;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
isEditingAny(arg0) {
return null != closure_4[arg0];
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
getEditingTextValue(id) {
let textValue;
if (closure_4[id] != null) {
textValue = tmp.textValue;
}
return textValue;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
getEditingRichValue(arg0) {
let richValue;
if (closure_4[arg0] != null) {
richValue = tmp.richValue;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
return richValue;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
getEditingMessageId(id) {
let messageId;
if (closure_4[id] != null) {
messageId = tmp.messageId;
}
return messageId;
}
getEditingMessage(id) {
let message = null;
if (null != closure_4[id]) {
message = null;
if (null != closure_4[id].messageId) {
message = MessageStore.getMessage(id, tmp.messageId);
}
}
return message;
}
getEditActionSource(channel_id) {
return closure_5[channel_id];
}
}
const prototype = EditMessageStore.prototype;
2026-07-29 08:29:29 +00:00
EditMessageStore.displayName = "EditMessageStore";
2026-10-03 08:58:59 +00:00
let obj = {
2026-07-20 16:05:17 +00:00
MESSAGE_START_EDIT: function handleMessageStartEdit(arg0) {
2026-10-03 08:58:59 +00:00
let channelId;
let content;
let messageId;
let source;
let toRichValue;
2026-07-20 16:05:17 +00:00
({ channelId, content } = arg0);
({ messageId, source } = arg0);
const UseLegacyChatInput = UserSettings.UseLegacyChatInput;
2026-07-20 16:05:17 +00:00
const setting = UseLegacyChatInput.getSetting();
2026-10-03 08:58:59 +00:00
const obj = MessageParserDefault;
const unparseResult = obj.unparse(content, channelId);
const obj2 = { channelId, messageId, textValue: unparseResult, richValue: toRichValue(content) };
toRichValue = SlateUtils.toRichValue;
SlateUtils;
const tmp3 = closure_4;
2026-07-20 16:05:17 +00:00
if (setting) {
content = unparseResult;
}
tmp3[channelId] = obj2;
2026-07-29 08:29:29 +00:00
closure_5[channelId] = source;
2026-07-20 16:05:17 +00:00
},
MESSAGE_UPDATE_EDIT: function handleMessageUpdateEdit(channelId) {
channelId = channelId.channelId;
2026-10-03 08:58:59 +00:00
if (null == closure_4[channelId]) {
2026-07-20 16:05:17 +00:00
return false;
} else {
2026-10-03 08:58:59 +00:00
const obj = { textValue: tmp, richValue: tmp2 };
2026-07-20 16:05:17 +00:00
const merged = Object.assign(tmp3);
2026-10-03 08:58:59 +00:00
closure_4[channelId] = obj;
2026-07-20 16:05:17 +00:00
}
},
MESSAGE_END_EDIT: function handleMessageEndEdit(channelId) {
channelId = channelId.channelId;
if (null != channelId) {
2026-10-03 08:58:59 +00:00
if (null != closure_4[channelId]) {
delete closure_4[channelId];
delete closure_5[channelId];
2026-07-20 16:05:17 +00:00
}
}
return false;
},
2026-10-03 08:58:59 +00:00
MESSAGE_DELETE: function handleMessageDelete(channelId) {
channelId = channelId.channelId;
2026-07-20 16:05:17 +00:00
let messageId;
2026-10-03 08:58:59 +00:00
const id = channelId.id;
if (closure_4[channelId] != null) {
messageId = tmp.messageId;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
if (messageId === id) {
delete closure_4[channelId];
delete closure_5[channelId];
2026-07-20 16:05:17 +00:00
}
},
LOGOUT: function handleLogout() {
2026-08-24 06:08:38 +00:00
closure_4 = {};
closure_5 = {};
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
};
const editMessageStore = new EditMessageStore(DispatcherDefault, obj);
const result = size.fileFinishedImporting("stores/EditMessageStore.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default editMessageStore;