cleanup
This commit is contained in:
@@ -8,7 +8,7 @@ function writeVersion(fileName, useExport) {
|
||||
{ flag: 'w' },
|
||||
(err) => {
|
||||
if (err) {
|
||||
return console.log(err);
|
||||
return console.error(err);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
@@ -55,6 +55,17 @@ export default class HashNavigation {
|
||||
return HashNavigation.composeUrlHash(parsed.path, parsed.params);
|
||||
}
|
||||
|
||||
static removeUrlParams(hash, keys) {
|
||||
if (!Array.isArray(keys)) {
|
||||
keys = [keys];
|
||||
}
|
||||
const parsed = HashNavigation.parseUrlHash(hash);
|
||||
for (const key of keys) {
|
||||
delete parsed.params[key];
|
||||
}
|
||||
return HashNavigation.composeUrlHash(parsed.path, parsed.params);
|
||||
}
|
||||
|
||||
static setUrlSidePanel(hash, sidepanel) {
|
||||
const parsed = HashNavigation.parseUrlHash(hash);
|
||||
parsed.path[0] = sidepanel;
|
||||
|
||||
@@ -391,9 +391,12 @@ class MessagesView extends React.Component {
|
||||
|
||||
if (nextProps.forwardMessage) {
|
||||
if (nextProps.forwardMessage.content) {
|
||||
const content = nextProps.forwardMessage.content;
|
||||
const size = content?.length || (content?.size || 0);
|
||||
nextState.docPreview = {
|
||||
object: nextProps.forwardMessage.content,
|
||||
type: nextProps.forwardMessage.type
|
||||
object: content,
|
||||
type: nextProps.forwardMessage.type,
|
||||
size: size
|
||||
};
|
||||
} else {
|
||||
// We are forwarding a message. Show preview.
|
||||
@@ -1022,7 +1025,7 @@ class MessagesView extends React.Component {
|
||||
// sendMessage sends the message with an optional subscription to topic first.
|
||||
sendMessage(msg, uploadCompletionPromise, uploader) {
|
||||
let head;
|
||||
if (this.props.forwardMessage) {
|
||||
if (!msg && this.props.forwardMessage) {
|
||||
// We are forwarding a message.
|
||||
msg = this.props.forwardMessage.msg;
|
||||
head = this.props.forwardMessage.head;
|
||||
@@ -1068,7 +1071,7 @@ class MessagesView extends React.Component {
|
||||
const maxInbandAttachmentSize = (this.props.tinode.getServerParam('maxMessageSize',
|
||||
MAX_INBAND_ATTACHMENT_SIZE) * 0.75 - 1024) | 0;
|
||||
|
||||
if (TheCard.isFileSupported(file.type, file.name)) {
|
||||
if (TheCard.isFileSupported(file.type, file.name) || file.type == TheCard.contentType) {
|
||||
// This is a vCard file, try to convert and send as TheCard.
|
||||
if (this.sendTheCardAttachment(file, maxInbandAttachmentSize)) {
|
||||
// Successfully sent as TheCard.
|
||||
@@ -1118,6 +1121,12 @@ class MessagesView extends React.Component {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (file.type == TheCard.contentType) {
|
||||
// Already TheCard, no need to convert.
|
||||
this.sendMessage(Drafty.appendTheCard(null, file.object));
|
||||
return true;
|
||||
}
|
||||
|
||||
importVCard(file)
|
||||
.then(card => {
|
||||
this.sendMessage(Drafty.appendTheCard(null, card));
|
||||
|
||||
@@ -34,9 +34,13 @@ class NewTopicView extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
const urlParams = HashNavigation.parseUrlHash(window.location.hash).params;
|
||||
const initialTab = urlParams['tab'] || 'find';
|
||||
const initialQuery = initialTab == 'find' ? (urlParams['q'] || null) : null;
|
||||
|
||||
this.state = {
|
||||
tabSelected: 'find',
|
||||
searchQuery: null
|
||||
tabSelected: initialTab,
|
||||
searchQuery: initialQuery
|
||||
};
|
||||
|
||||
this.handleTabClick = this.handleTabClick.bind(this);
|
||||
@@ -83,19 +87,19 @@ class NewTopicView extends React.Component {
|
||||
|
||||
handleSearchResultSelected(topicName) {
|
||||
if (this.state.tabSelected == 'find') {
|
||||
HashNavigation.navigateTo(HashNavigation.removeUrlParam(window.location.hash, 'tab'));
|
||||
HashNavigation.navigateTo(HashNavigation.removeUrlParams(window.location.hash, ['tab', 'q']));
|
||||
this.props.onCreateTopic(topicName);
|
||||
}
|
||||
}
|
||||
|
||||
handleNewGroupSubmit(name, description, dataUrl, priv, tags, isChannel) {
|
||||
HashNavigation.navigateTo(HashNavigation.removeUrlParam(window.location.hash, 'tab'));
|
||||
HashNavigation.navigateTo(HashNavigation.removeUrlParams(window.location.hash, ['tab', 'q']));
|
||||
this.props.onCreateTopic(undefined,
|
||||
{public: theCard(name, dataUrl, null, description), private: priv, tags: tags}, isChannel);
|
||||
}
|
||||
|
||||
handleGroupByID(topicName) {
|
||||
HashNavigation.navigateTo(HashNavigation.removeUrlParam(window.location.hash, 'tab'));
|
||||
HashNavigation.navigateTo(HashNavigation.removeUrlParams(window.location.hash, ['tab', 'q']));
|
||||
this.props.onCreateTopic(topicName);
|
||||
}
|
||||
|
||||
@@ -131,14 +135,17 @@ class NewTopicView extends React.Component {
|
||||
tinode={this.props.tinode}
|
||||
onSubmit={this.handleNewGroupSubmit}
|
||||
onError={this.props.onError} /> :
|
||||
|
||||
this.state.tabSelected === 'byid' ?
|
||||
<NewTopicById
|
||||
myURI={Tinode.URI_TOPIC_ID_PREFIX + this.props.tinode.getCurrentUserID()}
|
||||
onSubmit={this.handleGroupByID}
|
||||
onError={this.props.onError} /> :
|
||||
|
||||
<div className="flex-column">
|
||||
<SearchContacts
|
||||
placeholder={search_placeholder}
|
||||
initialQuery={this.state.searchQuery || ''}
|
||||
onSearchContacts={this.handleSearchContacts} />
|
||||
<ContactList
|
||||
tinode={this.props.tinode}
|
||||
|
||||
@@ -1150,7 +1150,6 @@ class TinodeWeb extends React.Component {
|
||||
// - head - head dictionary to be attached to the message
|
||||
handleSendMessage(msg, uploadCompletionPromise, uploader, head) {
|
||||
const topic = this.tinode.getTopic(this.state.topicSelected);
|
||||
/* TODO: check if return is required */
|
||||
return this.sendMessageToTopic(topic, msg, uploadCompletionPromise, uploader, head);
|
||||
}
|
||||
|
||||
|
||||
@@ -346,11 +346,11 @@ class CallPanel extends React.PureComponent {
|
||||
}
|
||||
|
||||
handleDataChannelClose(event) {
|
||||
console.log('close data channel:', event);
|
||||
console.info('close data channel:', event);
|
||||
}
|
||||
|
||||
handleDataChannelEvent(event) {
|
||||
console.log('data channel event:', event);
|
||||
console.info('data channel event:', event);
|
||||
const channel = event.channel;
|
||||
channel.onerror = this.handleDataChannelError;
|
||||
channel.onmessage = this.handleDataChannelMessage;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import React from 'react';
|
||||
import { FormattedMessage, injectIntl } from 'react-intl';
|
||||
import { Drafty, Tinode } from 'tinode-sdk';
|
||||
import { Drafty, Tinode, TheCard } from 'tinode-sdk';
|
||||
|
||||
import Attachment from './attachment.jsx';
|
||||
import LetterTile from './letter-tile.jsx';
|
||||
@@ -10,6 +10,7 @@ import ReceivedMarker from './received-marker.jsx'
|
||||
|
||||
import { fullFormatter } from '../lib/formatters.js';
|
||||
import { sanitizeUrl } from '../lib/utils.js';
|
||||
import HashNavigation from '../lib/navigation.js';
|
||||
|
||||
class BaseChatMessage extends React.PureComponent {
|
||||
constructor(props) {
|
||||
@@ -55,13 +56,26 @@ class BaseChatMessage extends React.PureComponent {
|
||||
this.handleQuoteClick(e);
|
||||
break;
|
||||
case 'contact_chat':
|
||||
e.preventDefault();
|
||||
try {
|
||||
// tinode:topic/usr123abc -> usr123abc
|
||||
const pathname = new URL(e.target.dataset.val)?.pathname;
|
||||
const parts = pathname.split('/').filter(Boolean);
|
||||
HashNavigation.navigateTo(HashNavigation.setUrlTopic('', parts.pop() || ''));
|
||||
} catch (error) {
|
||||
console.error("Invalid URL:", error);
|
||||
}
|
||||
break;
|
||||
case 'contact_find':
|
||||
e.preventDefault();
|
||||
console.log('Contact click handling not implemented yet.', action, e.target.dataset);
|
||||
let hashUrl = HashNavigation.setUrlSidePanel(window.location.hash, 'newtpk');
|
||||
hashUrl = HashNavigation.addUrlParam(hashUrl, 'q', e.target.dataset.val);
|
||||
hashUrl = HashNavigation.addUrlParam(hashUrl, 'tab', 'find');
|
||||
HashNavigation.navigateTo(hashUrl);
|
||||
break;
|
||||
default:
|
||||
// No special handling; let the browser deal with it.
|
||||
console.log('Unhandled drafty action.', action, e.target.dataset);
|
||||
console.info('Unhandled drafty action.', action, e.target.dataset);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ export default class SearchContacts extends React.PureComponent {
|
||||
|
||||
this.state = {
|
||||
edited: false,
|
||||
search: ''
|
||||
search: this.props.initialQuery || ''
|
||||
};
|
||||
|
||||
this.handleSearchChange = this.handleSearchChange.bind(this);
|
||||
@@ -47,7 +47,8 @@ export default class SearchContacts extends React.PureComponent {
|
||||
if (e.key === 'Enter') {
|
||||
this.handleSearch(e);
|
||||
} else if (e.key === 'Escape') {
|
||||
this.handleClear();
|
||||
e.stopPropagation();
|
||||
this.handleClear(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -71,20 +71,24 @@ class TheCardMini extends React.PureComponent {
|
||||
</div>
|
||||
</div>
|
||||
<div className="contact-actions">
|
||||
{uid &&
|
||||
{uid ?
|
||||
<>
|
||||
<a className="flat-button" data-val={uid} onClick={this.props.onChatClick}>
|
||||
<FormattedMessage id="chat_now" defaultMessage="Chat"
|
||||
description="Label for message button in contact card" />
|
||||
</a>
|
||||
}
|
||||
{uid && <div className="divider"></div>}
|
||||
{contacts.length > 0 &&
|
||||
<a className="flat-button" data-val={contacts.join(',')} onClick={this.props.onChatClick}>
|
||||
<div className="divider"></div>
|
||||
</>
|
||||
: contacts.length > 0 ?
|
||||
<>
|
||||
<a className="flat-button" data-val={contacts.join(',')} onClick={this.props.onFindClick}>
|
||||
<FormattedMessage id="find_user" defaultMessage="Find"
|
||||
description="Label for search button in contact card" />
|
||||
</a>
|
||||
<div className="divider"></div>
|
||||
</>
|
||||
: null
|
||||
}
|
||||
{contacts.length > 0 && <div className="divider"></div>}
|
||||
<a className="flat-button" onClick={this.handleDownload}>
|
||||
<FormattedMessage id="save_action" defaultMessage="Save" description="Label for Save button" />
|
||||
</a>
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+38
-10
@@ -9533,9 +9533,12 @@ const messages = (0,react_intl__WEBPACK_IMPORTED_MODULE_1__.defineMessages)({
|
||||
class NewTopicView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component) {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
const urlParams = _lib_navigation_js__WEBPACK_IMPORTED_MODULE_7__["default"].parseUrlHash(window.location.hash).params;
|
||||
const initialTab = urlParams['tab'] || 'find';
|
||||
const initialQuery = initialTab == 'find' ? urlParams['q'] || null : null;
|
||||
this.state = {
|
||||
tabSelected: 'find',
|
||||
searchQuery: null
|
||||
tabSelected: initialTab,
|
||||
searchQuery: initialQuery
|
||||
};
|
||||
this.handleTabClick = this.handleTabClick.bind(this);
|
||||
this.handleSearchContacts = this.handleSearchContacts.bind(this);
|
||||
@@ -9652,6 +9655,7 @@ class NewTopicView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
||||
className: "flex-column"
|
||||
}, react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_search_contacts_jsx__WEBPACK_IMPORTED_MODULE_6__["default"], {
|
||||
placeholder: search_placeholder,
|
||||
initialQuery: this.state.searchQuery || '',
|
||||
onSearchContacts: this.handleSearchContacts
|
||||
}), react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_contact_list_jsx__WEBPACK_IMPORTED_MODULE_3__["default"], {
|
||||
tinode: this.props.tinode,
|
||||
@@ -10332,6 +10336,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
||||
this.handleResize = this.handleResize.bind(this);
|
||||
this.handleHashRoute = this.handleHashRoute.bind(this);
|
||||
this.handleOnline = this.handleOnline.bind(this);
|
||||
this.handleEscapeKey = this.handleEscapeKey.bind(this);
|
||||
this.handleColorSchemeChange = this.handleColorSchemeChange.bind(this);
|
||||
this.checkForAppUpdate = this.checkForAppUpdate.bind(this);
|
||||
this.handleVisibilityEvent = this.handleVisibilityEvent.bind(this);
|
||||
@@ -10506,6 +10511,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
||||
window.addEventListener('hashchange', this.handleHashRoute);
|
||||
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', this.handleColorSchemeChange);
|
||||
document.addEventListener('visibilitychange', this.handleVisibilityEvent);
|
||||
document.addEventListener('keydown', this.handleEscapeKey);
|
||||
document.documentElement.style.colorScheme = this.state.colorSchema == 'auto' ? 'light dark' : this.state.colorSchema;
|
||||
document.documentElement.style.setProperty('--message-text-size', `${this.state.textSize}pt`);
|
||||
this.applyWallpaperSettings(this.state.wallpaper, this.state.wallpaperSize, this.state.wallpaperBlur, this.state.colorSchema == 'auto' ? this.state.systemColorSchema : this.state.colorSchema);
|
||||
@@ -10569,6 +10575,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
||||
window.removeEventListener('offline', this.handleOnlineOff);
|
||||
window.matchMedia('(prefers-color-scheme: dark)').removeEventListener('change', this.handleColorSchemeChange);
|
||||
document.removeEventListener('visibilitychange', this.handleVisibilityEvent);
|
||||
document.removeEventListener('keydown', this.handleEscapeKey);
|
||||
clearInterval(this.wakeUpTicker);
|
||||
}
|
||||
static tnSetup(serverAddress, secureConnection, transport, locale, persistentCache, onSetupCompleted) {
|
||||
@@ -10684,6 +10691,24 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
||||
});
|
||||
}
|
||||
}
|
||||
handleEscapeKey(e) {
|
||||
if (e.key === 'Escape' || e.keyCode === 27) {
|
||||
this.setState({
|
||||
topicSelected: null,
|
||||
errorText: '',
|
||||
errorLevel: null,
|
||||
mobilePanel: 'sidepanel',
|
||||
topicSelectedOnline: false,
|
||||
topicSelectedAcs: null,
|
||||
infoPanel: undefined,
|
||||
forwardMessage: null,
|
||||
contextMenuVisible: false,
|
||||
forwardDialogVisible: false,
|
||||
alertVisible: false
|
||||
});
|
||||
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__["default"].navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__["default"].setUrlTopic('', null));
|
||||
}
|
||||
}
|
||||
checkForAppUpdate(reg) {
|
||||
reg.onupdatefound = _ => {
|
||||
const installingWorker = reg.installing;
|
||||
@@ -11184,10 +11209,12 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
||||
}
|
||||
handleSendMessage(msg, uploadCompletionPromise, uploader, head) {
|
||||
const topic = this.tinode.getTopic(this.state.topicSelected);
|
||||
console.log("handleSendMessage", msg);
|
||||
return this.sendMessageToTopic(topic, msg, uploadCompletionPromise, uploader, head);
|
||||
}
|
||||
sendMessageToTopic(topic, msg, uploadCompletionPromise, uploader, head) {
|
||||
msg = topic.createMessage(msg, false);
|
||||
console.log("sendMessageToTopic", msg, head);
|
||||
msg._uploader = uploader;
|
||||
if (head) {
|
||||
msg.head = Object.assign(msg.head || {}, head);
|
||||
@@ -16196,7 +16223,7 @@ class SearchContacts extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureC
|
||||
super(props);
|
||||
this.state = {
|
||||
edited: false,
|
||||
search: ''
|
||||
search: this.props.initialQuery || ''
|
||||
};
|
||||
this.handleSearchChange = this.handleSearchChange.bind(this);
|
||||
this.handleSearch = this.handleSearch.bind(this);
|
||||
@@ -16239,7 +16266,8 @@ class SearchContacts extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureC
|
||||
if (e.key === 'Enter') {
|
||||
this.handleSearch(e);
|
||||
} else if (e.key === 'Escape') {
|
||||
this.handleClear();
|
||||
e.stopPropagation();
|
||||
this.handleClear(e);
|
||||
}
|
||||
}
|
||||
render() {
|
||||
@@ -16639,7 +16667,7 @@ class TheCardMini extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureComp
|
||||
className: "org"
|
||||
}, org))), react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
||||
className: "contact-actions"
|
||||
}, uid && react__WEBPACK_IMPORTED_MODULE_0___default().createElement("a", {
|
||||
}, uid ? react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, react__WEBPACK_IMPORTED_MODULE_0___default().createElement("a", {
|
||||
className: "flat-button",
|
||||
"data-val": uid,
|
||||
onClick: this.props.onChatClick
|
||||
@@ -16649,21 +16677,21 @@ class TheCardMini extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureComp
|
||||
"type": 0,
|
||||
"value": "Chat"
|
||||
}]
|
||||
})), uid && react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
||||
})), react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
||||
className: "divider"
|
||||
}), contacts.length > 0 && react__WEBPACK_IMPORTED_MODULE_0___default().createElement("a", {
|
||||
})) : contacts.length > 0 ? react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, react__WEBPACK_IMPORTED_MODULE_0___default().createElement("a", {
|
||||
className: "flat-button",
|
||||
"data-val": contacts.join(','),
|
||||
onClick: this.props.onChatClick
|
||||
onClick: this.props.onFindClick
|
||||
}, react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react_intl__WEBPACK_IMPORTED_MODULE_1__.FormattedMessage, {
|
||||
id: "find_user",
|
||||
defaultMessage: [{
|
||||
"type": 0,
|
||||
"value": "Find"
|
||||
}]
|
||||
})), contacts.length > 0 && react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
||||
})), react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
||||
className: "divider"
|
||||
}), react__WEBPACK_IMPORTED_MODULE_0___default().createElement("a", {
|
||||
})) : null, react__WEBPACK_IMPORTED_MODULE_0___default().createElement("a", {
|
||||
className: "flat-button",
|
||||
onClick: this.handleDownload
|
||||
}, react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react_intl__WEBPACK_IMPORTED_MODULE_1__.FormattedMessage, {
|
||||
|
||||
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -575,9 +575,12 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
||||
};
|
||||
if (nextProps.forwardMessage) {
|
||||
if (nextProps.forwardMessage.content) {
|
||||
const content = nextProps.forwardMessage.content;
|
||||
const size = content?.length || content?.size || 0;
|
||||
nextState.docPreview = {
|
||||
object: nextProps.forwardMessage.content,
|
||||
type: nextProps.forwardMessage.type
|
||||
object: content,
|
||||
type: nextProps.forwardMessage.type,
|
||||
size: size
|
||||
};
|
||||
} else {
|
||||
nextState.reply = {
|
||||
@@ -1144,7 +1147,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
||||
}
|
||||
sendMessage(msg, uploadCompletionPromise, uploader) {
|
||||
let head;
|
||||
if (this.props.forwardMessage) {
|
||||
if (!msg && this.props.forwardMessage) {
|
||||
msg = this.props.forwardMessage.msg;
|
||||
head = this.props.forwardMessage.head;
|
||||
this.handleCancelReply();
|
||||
@@ -1178,7 +1181,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
||||
}
|
||||
sendFileAttachment(file) {
|
||||
const maxInbandAttachmentSize = this.props.tinode.getServerParam('maxMessageSize', _config_js__WEBPACK_IMPORTED_MODULE_14__.MAX_INBAND_ATTACHMENT_SIZE) * 0.75 - 1024 | 0;
|
||||
if (tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.TheCard.isFileSupported(file.type, file.name)) {
|
||||
if (tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.TheCard.isFileSupported(file.type, file.name) || file.type == tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.TheCard.contentType) {
|
||||
if (this.sendTheCardAttachment(file, maxInbandAttachmentSize)) {
|
||||
return;
|
||||
}
|
||||
@@ -1211,6 +1214,11 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
||||
if (file.size > maxInbandAttachmentSize) {
|
||||
return false;
|
||||
}
|
||||
if (file.type == tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.TheCard.contentType) {
|
||||
console.log("TheCard attachment", file.object);
|
||||
this.sendMessage(tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.appendTheCard(null, file.object));
|
||||
return true;
|
||||
}
|
||||
(0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_16__.importVCard)(file).then(card => {
|
||||
this.sendMessage(tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.appendTheCard(null, card));
|
||||
}).catch(err => {
|
||||
@@ -2128,6 +2136,7 @@ __webpack_require__.r(__webpack_exports__);
|
||||
/* harmony import */ var _received_marker_jsx__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./received-marker.jsx */ "./src/widgets/received-marker.jsx");
|
||||
/* harmony import */ var _lib_formatters_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../lib/formatters.js */ "./src/lib/formatters.js");
|
||||
/* harmony import */ var _lib_utils_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../lib/utils.js */ "./src/lib/utils.js");
|
||||
/* harmony import */ var _lib_navigation_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../lib/navigation.js */ "./src/lib/navigation.js");
|
||||
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
|
||||
|
||||
@@ -2137,6 +2146,7 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
|
||||
|
||||
|
||||
|
||||
|
||||
class BaseChatMessage extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureComponent) {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
@@ -2175,9 +2185,22 @@ class BaseChatMessage extends (react__WEBPACK_IMPORTED_MODULE_0___default().Pure
|
||||
this.handleQuoteClick(e);
|
||||
break;
|
||||
case 'contact_chat':
|
||||
e.preventDefault();
|
||||
try {
|
||||
const pathname = new URL(e.target.dataset.val)?.pathname;
|
||||
const parts = pathname.split('/').filter(Boolean);
|
||||
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_8__["default"].navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_8__["default"].setUrlTopic('', parts.pop() || ''));
|
||||
} catch (error) {
|
||||
console.error("Invalid URL:", error);
|
||||
}
|
||||
break;
|
||||
case 'contact_find':
|
||||
e.preventDefault();
|
||||
console.log('Contact click handling not implemented yet.', action, e.target.dataset);
|
||||
let hashUrl = _lib_navigation_js__WEBPACK_IMPORTED_MODULE_8__["default"].setUrlSidePanel(window.location.hash, 'newtpk');
|
||||
hashUrl = _lib_navigation_js__WEBPACK_IMPORTED_MODULE_8__["default"].addUrlParam(hashUrl, 'q', e.target.dataset.val);
|
||||
hashUrl = _lib_navigation_js__WEBPACK_IMPORTED_MODULE_8__["default"].addUrlParam(hashUrl, 'tab', 'find');
|
||||
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_8__["default"].navigateTo(hashUrl);
|
||||
console.log('Finding contact(s):', hashUrl);
|
||||
break;
|
||||
default:
|
||||
console.log('Unhandled drafty action.', action, e.target.dataset);
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -2346,6 +2346,7 @@ Drafty.appendTheCard = function (content, theCardData) {
|
||||
tp: 'TC',
|
||||
data: theCardData
|
||||
});
|
||||
console.log('Appended TheCard entity:', content);
|
||||
return content;
|
||||
};
|
||||
Drafty.UNSAFE_toHTML = function (doc) {
|
||||
@@ -3990,6 +3991,9 @@ class TheCard {
|
||||
get contentType() {
|
||||
return THE_CARD_MIME_TYPE;
|
||||
}
|
||||
get size() {
|
||||
return JSON.stringify(this).length;
|
||||
}
|
||||
}
|
||||
TheCard.contentType = THE_CARD_MIME_TYPE;
|
||||
TheCard.setFn = function (card, fn) {
|
||||
@@ -4669,6 +4673,7 @@ class Topic {
|
||||
pub._sending = true;
|
||||
pub._failed = false;
|
||||
let attachments = null;
|
||||
console.log("Publishing message", pub);
|
||||
if (_drafty_js__WEBPACK_IMPORTED_MODULE_4___default().hasEntities(pub.content)) {
|
||||
attachments = [];
|
||||
_drafty_js__WEBPACK_IMPORTED_MODULE_4___default().entities(pub.content, data => {
|
||||
@@ -7134,6 +7139,7 @@ class Tinode {
|
||||
}
|
||||
pkt.pub.noecho = noEcho;
|
||||
pkt.pub.content = content;
|
||||
console.log("Tinode.createMessage", pkt.pub);
|
||||
return pkt.pub;
|
||||
}
|
||||
publish(topicName, content, noEcho) {
|
||||
@@ -7420,6 +7426,7 @@ Tinode.MAX_FILE_UPLOAD_SIZE = 'maxFileUploadSize';
|
||||
Tinode.REQ_CRED_VALIDATORS = 'reqCred';
|
||||
Tinode.MSG_DELETE_AGE = 'msgDelAge';
|
||||
Tinode.URI_TOPIC_ID_PREFIX = 'tinode:topic/';
|
||||
Tinode.URI_TOPIC_ALIAS_PREFIX = 'tinode:alias/';
|
||||
Tinode.TAG_ALIAS = _config_js__WEBPACK_IMPORTED_MODULE_1__.TAG_ALIAS;
|
||||
Tinode.TAG_EMAIL = _config_js__WEBPACK_IMPORTED_MODULE_1__.TAG_EMAIL;
|
||||
Tinode.TAG_PHONE = _config_js__WEBPACK_IMPORTED_MODULE_1__.TAG_PHONE;
|
||||
|
||||
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user