cleanup
This commit is contained in:
@@ -8,7 +8,7 @@ function writeVersion(fileName, useExport) {
|
|||||||
{ flag: 'w' },
|
{ flag: 'w' },
|
||||||
(err) => {
|
(err) => {
|
||||||
if (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);
|
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) {
|
static setUrlSidePanel(hash, sidepanel) {
|
||||||
const parsed = HashNavigation.parseUrlHash(hash);
|
const parsed = HashNavigation.parseUrlHash(hash);
|
||||||
parsed.path[0] = sidepanel;
|
parsed.path[0] = sidepanel;
|
||||||
|
|||||||
@@ -391,9 +391,12 @@ class MessagesView extends React.Component {
|
|||||||
|
|
||||||
if (nextProps.forwardMessage) {
|
if (nextProps.forwardMessage) {
|
||||||
if (nextProps.forwardMessage.content) {
|
if (nextProps.forwardMessage.content) {
|
||||||
|
const content = nextProps.forwardMessage.content;
|
||||||
|
const size = content?.length || (content?.size || 0);
|
||||||
nextState.docPreview = {
|
nextState.docPreview = {
|
||||||
object: nextProps.forwardMessage.content,
|
object: content,
|
||||||
type: nextProps.forwardMessage.type
|
type: nextProps.forwardMessage.type,
|
||||||
|
size: size
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
// We are forwarding a message. Show preview.
|
// 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 sends the message with an optional subscription to topic first.
|
||||||
sendMessage(msg, uploadCompletionPromise, uploader) {
|
sendMessage(msg, uploadCompletionPromise, uploader) {
|
||||||
let head;
|
let head;
|
||||||
if (this.props.forwardMessage) {
|
if (!msg && this.props.forwardMessage) {
|
||||||
// We are forwarding a message.
|
// We are forwarding a message.
|
||||||
msg = this.props.forwardMessage.msg;
|
msg = this.props.forwardMessage.msg;
|
||||||
head = this.props.forwardMessage.head;
|
head = this.props.forwardMessage.head;
|
||||||
@@ -1068,7 +1071,7 @@ class MessagesView extends React.Component {
|
|||||||
const maxInbandAttachmentSize = (this.props.tinode.getServerParam('maxMessageSize',
|
const maxInbandAttachmentSize = (this.props.tinode.getServerParam('maxMessageSize',
|
||||||
MAX_INBAND_ATTACHMENT_SIZE) * 0.75 - 1024) | 0;
|
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.
|
// This is a vCard file, try to convert and send as TheCard.
|
||||||
if (this.sendTheCardAttachment(file, maxInbandAttachmentSize)) {
|
if (this.sendTheCardAttachment(file, maxInbandAttachmentSize)) {
|
||||||
// Successfully sent as TheCard.
|
// Successfully sent as TheCard.
|
||||||
@@ -1118,6 +1121,12 @@ class MessagesView extends React.Component {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (file.type == TheCard.contentType) {
|
||||||
|
// Already TheCard, no need to convert.
|
||||||
|
this.sendMessage(Drafty.appendTheCard(null, file.object));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
importVCard(file)
|
importVCard(file)
|
||||||
.then(card => {
|
.then(card => {
|
||||||
this.sendMessage(Drafty.appendTheCard(null, card));
|
this.sendMessage(Drafty.appendTheCard(null, card));
|
||||||
|
|||||||
@@ -34,9 +34,13 @@ class NewTopicView extends React.Component {
|
|||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(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 = {
|
this.state = {
|
||||||
tabSelected: 'find',
|
tabSelected: initialTab,
|
||||||
searchQuery: null
|
searchQuery: initialQuery
|
||||||
};
|
};
|
||||||
|
|
||||||
this.handleTabClick = this.handleTabClick.bind(this);
|
this.handleTabClick = this.handleTabClick.bind(this);
|
||||||
@@ -83,19 +87,19 @@ class NewTopicView extends React.Component {
|
|||||||
|
|
||||||
handleSearchResultSelected(topicName) {
|
handleSearchResultSelected(topicName) {
|
||||||
if (this.state.tabSelected == 'find') {
|
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);
|
this.props.onCreateTopic(topicName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleNewGroupSubmit(name, description, dataUrl, priv, tags, isChannel) {
|
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,
|
this.props.onCreateTopic(undefined,
|
||||||
{public: theCard(name, dataUrl, null, description), private: priv, tags: tags}, isChannel);
|
{public: theCard(name, dataUrl, null, description), private: priv, tags: tags}, isChannel);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleGroupByID(topicName) {
|
handleGroupByID(topicName) {
|
||||||
HashNavigation.navigateTo(HashNavigation.removeUrlParam(window.location.hash, 'tab'));
|
HashNavigation.navigateTo(HashNavigation.removeUrlParams(window.location.hash, ['tab', 'q']));
|
||||||
this.props.onCreateTopic(topicName);
|
this.props.onCreateTopic(topicName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,14 +135,17 @@ class NewTopicView extends React.Component {
|
|||||||
tinode={this.props.tinode}
|
tinode={this.props.tinode}
|
||||||
onSubmit={this.handleNewGroupSubmit}
|
onSubmit={this.handleNewGroupSubmit}
|
||||||
onError={this.props.onError} /> :
|
onError={this.props.onError} /> :
|
||||||
|
|
||||||
this.state.tabSelected === 'byid' ?
|
this.state.tabSelected === 'byid' ?
|
||||||
<NewTopicById
|
<NewTopicById
|
||||||
myURI={Tinode.URI_TOPIC_ID_PREFIX + this.props.tinode.getCurrentUserID()}
|
myURI={Tinode.URI_TOPIC_ID_PREFIX + this.props.tinode.getCurrentUserID()}
|
||||||
onSubmit={this.handleGroupByID}
|
onSubmit={this.handleGroupByID}
|
||||||
onError={this.props.onError} /> :
|
onError={this.props.onError} /> :
|
||||||
|
|
||||||
<div className="flex-column">
|
<div className="flex-column">
|
||||||
<SearchContacts
|
<SearchContacts
|
||||||
placeholder={search_placeholder}
|
placeholder={search_placeholder}
|
||||||
|
initialQuery={this.state.searchQuery || ''}
|
||||||
onSearchContacts={this.handleSearchContacts} />
|
onSearchContacts={this.handleSearchContacts} />
|
||||||
<ContactList
|
<ContactList
|
||||||
tinode={this.props.tinode}
|
tinode={this.props.tinode}
|
||||||
|
|||||||
@@ -1150,7 +1150,6 @@ class TinodeWeb extends React.Component {
|
|||||||
// - head - head dictionary to be attached to the message
|
// - head - head dictionary to be attached to the message
|
||||||
handleSendMessage(msg, uploadCompletionPromise, uploader, head) {
|
handleSendMessage(msg, uploadCompletionPromise, uploader, head) {
|
||||||
const topic = this.tinode.getTopic(this.state.topicSelected);
|
const topic = this.tinode.getTopic(this.state.topicSelected);
|
||||||
/* TODO: check if return is required */
|
|
||||||
return this.sendMessageToTopic(topic, msg, uploadCompletionPromise, uploader, head);
|
return this.sendMessageToTopic(topic, msg, uploadCompletionPromise, uploader, head);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -346,11 +346,11 @@ class CallPanel extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleDataChannelClose(event) {
|
handleDataChannelClose(event) {
|
||||||
console.log('close data channel:', event);
|
console.info('close data channel:', event);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleDataChannelEvent(event) {
|
handleDataChannelEvent(event) {
|
||||||
console.log('data channel event:', event);
|
console.info('data channel event:', event);
|
||||||
const channel = event.channel;
|
const channel = event.channel;
|
||||||
channel.onerror = this.handleDataChannelError;
|
channel.onerror = this.handleDataChannelError;
|
||||||
channel.onmessage = this.handleDataChannelMessage;
|
channel.onmessage = this.handleDataChannelMessage;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { FormattedMessage, injectIntl } from 'react-intl';
|
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 Attachment from './attachment.jsx';
|
||||||
import LetterTile from './letter-tile.jsx';
|
import LetterTile from './letter-tile.jsx';
|
||||||
@@ -10,6 +10,7 @@ import ReceivedMarker from './received-marker.jsx'
|
|||||||
|
|
||||||
import { fullFormatter } from '../lib/formatters.js';
|
import { fullFormatter } from '../lib/formatters.js';
|
||||||
import { sanitizeUrl } from '../lib/utils.js';
|
import { sanitizeUrl } from '../lib/utils.js';
|
||||||
|
import HashNavigation from '../lib/navigation.js';
|
||||||
|
|
||||||
class BaseChatMessage extends React.PureComponent {
|
class BaseChatMessage extends React.PureComponent {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
@@ -55,13 +56,26 @@ class BaseChatMessage extends React.PureComponent {
|
|||||||
this.handleQuoteClick(e);
|
this.handleQuoteClick(e);
|
||||||
break;
|
break;
|
||||||
case 'contact_chat':
|
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':
|
case 'contact_find':
|
||||||
e.preventDefault();
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
// No special handling; let the browser deal with it.
|
// 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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export default class SearchContacts extends React.PureComponent {
|
|||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
edited: false,
|
edited: false,
|
||||||
search: ''
|
search: this.props.initialQuery || ''
|
||||||
};
|
};
|
||||||
|
|
||||||
this.handleSearchChange = this.handleSearchChange.bind(this);
|
this.handleSearchChange = this.handleSearchChange.bind(this);
|
||||||
@@ -47,7 +47,8 @@ export default class SearchContacts extends React.PureComponent {
|
|||||||
if (e.key === 'Enter') {
|
if (e.key === 'Enter') {
|
||||||
this.handleSearch(e);
|
this.handleSearch(e);
|
||||||
} else if (e.key === 'Escape') {
|
} else if (e.key === 'Escape') {
|
||||||
this.handleClear();
|
e.stopPropagation();
|
||||||
|
this.handleClear(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,20 +71,24 @@ class TheCardMini extends React.PureComponent {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="contact-actions">
|
<div className="contact-actions">
|
||||||
{uid &&
|
{uid ?
|
||||||
|
<>
|
||||||
<a className="flat-button" data-val={uid} onClick={this.props.onChatClick}>
|
<a className="flat-button" data-val={uid} onClick={this.props.onChatClick}>
|
||||||
<FormattedMessage id="chat_now" defaultMessage="Chat"
|
<FormattedMessage id="chat_now" defaultMessage="Chat"
|
||||||
description="Label for message button in contact card" />
|
description="Label for message button in contact card" />
|
||||||
</a>
|
</a>
|
||||||
}
|
<div className="divider"></div>
|
||||||
{uid && <div className="divider"></div>}
|
</>
|
||||||
{contacts.length > 0 &&
|
: contacts.length > 0 ?
|
||||||
<a className="flat-button" data-val={contacts.join(',')} onClick={this.props.onChatClick}>
|
<>
|
||||||
|
<a className="flat-button" data-val={contacts.join(',')} onClick={this.props.onFindClick}>
|
||||||
<FormattedMessage id="find_user" defaultMessage="Find"
|
<FormattedMessage id="find_user" defaultMessage="Find"
|
||||||
description="Label for search button in contact card" />
|
description="Label for search button in contact card" />
|
||||||
</a>
|
</a>
|
||||||
|
<div className="divider"></div>
|
||||||
|
</>
|
||||||
|
: null
|
||||||
}
|
}
|
||||||
{contacts.length > 0 && <div className="divider"></div>}
|
|
||||||
<a className="flat-button" onClick={this.handleDownload}>
|
<a className="flat-button" onClick={this.handleDownload}>
|
||||||
<FormattedMessage id="save_action" defaultMessage="Save" description="Label for Save button" />
|
<FormattedMessage id="save_action" defaultMessage="Save" description="Label for Save button" />
|
||||||
</a>
|
</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) {
|
class NewTopicView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component) {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(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 = {
|
this.state = {
|
||||||
tabSelected: 'find',
|
tabSelected: initialTab,
|
||||||
searchQuery: null
|
searchQuery: initialQuery
|
||||||
};
|
};
|
||||||
this.handleTabClick = this.handleTabClick.bind(this);
|
this.handleTabClick = this.handleTabClick.bind(this);
|
||||||
this.handleSearchContacts = this.handleSearchContacts.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"
|
className: "flex-column"
|
||||||
}, react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_search_contacts_jsx__WEBPACK_IMPORTED_MODULE_6__["default"], {
|
}, react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_search_contacts_jsx__WEBPACK_IMPORTED_MODULE_6__["default"], {
|
||||||
placeholder: search_placeholder,
|
placeholder: search_placeholder,
|
||||||
|
initialQuery: this.state.searchQuery || '',
|
||||||
onSearchContacts: this.handleSearchContacts
|
onSearchContacts: this.handleSearchContacts
|
||||||
}), react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_contact_list_jsx__WEBPACK_IMPORTED_MODULE_3__["default"], {
|
}), react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_contact_list_jsx__WEBPACK_IMPORTED_MODULE_3__["default"], {
|
||||||
tinode: this.props.tinode,
|
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.handleResize = this.handleResize.bind(this);
|
||||||
this.handleHashRoute = this.handleHashRoute.bind(this);
|
this.handleHashRoute = this.handleHashRoute.bind(this);
|
||||||
this.handleOnline = this.handleOnline.bind(this);
|
this.handleOnline = this.handleOnline.bind(this);
|
||||||
|
this.handleEscapeKey = this.handleEscapeKey.bind(this);
|
||||||
this.handleColorSchemeChange = this.handleColorSchemeChange.bind(this);
|
this.handleColorSchemeChange = this.handleColorSchemeChange.bind(this);
|
||||||
this.checkForAppUpdate = this.checkForAppUpdate.bind(this);
|
this.checkForAppUpdate = this.checkForAppUpdate.bind(this);
|
||||||
this.handleVisibilityEvent = this.handleVisibilityEvent.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.addEventListener('hashchange', this.handleHashRoute);
|
||||||
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', this.handleColorSchemeChange);
|
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', this.handleColorSchemeChange);
|
||||||
document.addEventListener('visibilitychange', this.handleVisibilityEvent);
|
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.colorScheme = this.state.colorSchema == 'auto' ? 'light dark' : this.state.colorSchema;
|
||||||
document.documentElement.style.setProperty('--message-text-size', `${this.state.textSize}pt`);
|
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);
|
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.removeEventListener('offline', this.handleOnlineOff);
|
||||||
window.matchMedia('(prefers-color-scheme: dark)').removeEventListener('change', this.handleColorSchemeChange);
|
window.matchMedia('(prefers-color-scheme: dark)').removeEventListener('change', this.handleColorSchemeChange);
|
||||||
document.removeEventListener('visibilitychange', this.handleVisibilityEvent);
|
document.removeEventListener('visibilitychange', this.handleVisibilityEvent);
|
||||||
|
document.removeEventListener('keydown', this.handleEscapeKey);
|
||||||
clearInterval(this.wakeUpTicker);
|
clearInterval(this.wakeUpTicker);
|
||||||
}
|
}
|
||||||
static tnSetup(serverAddress, secureConnection, transport, locale, persistentCache, onSetupCompleted) {
|
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) {
|
checkForAppUpdate(reg) {
|
||||||
reg.onupdatefound = _ => {
|
reg.onupdatefound = _ => {
|
||||||
const installingWorker = reg.installing;
|
const installingWorker = reg.installing;
|
||||||
@@ -11184,10 +11209,12 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
}
|
}
|
||||||
handleSendMessage(msg, uploadCompletionPromise, uploader, head) {
|
handleSendMessage(msg, uploadCompletionPromise, uploader, head) {
|
||||||
const topic = this.tinode.getTopic(this.state.topicSelected);
|
const topic = this.tinode.getTopic(this.state.topicSelected);
|
||||||
|
console.log("handleSendMessage", msg);
|
||||||
return this.sendMessageToTopic(topic, msg, uploadCompletionPromise, uploader, head);
|
return this.sendMessageToTopic(topic, msg, uploadCompletionPromise, uploader, head);
|
||||||
}
|
}
|
||||||
sendMessageToTopic(topic, msg, uploadCompletionPromise, uploader, head) {
|
sendMessageToTopic(topic, msg, uploadCompletionPromise, uploader, head) {
|
||||||
msg = topic.createMessage(msg, false);
|
msg = topic.createMessage(msg, false);
|
||||||
|
console.log("sendMessageToTopic", msg, head);
|
||||||
msg._uploader = uploader;
|
msg._uploader = uploader;
|
||||||
if (head) {
|
if (head) {
|
||||||
msg.head = Object.assign(msg.head || {}, head);
|
msg.head = Object.assign(msg.head || {}, head);
|
||||||
@@ -16196,7 +16223,7 @@ class SearchContacts extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureC
|
|||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
edited: false,
|
edited: false,
|
||||||
search: ''
|
search: this.props.initialQuery || ''
|
||||||
};
|
};
|
||||||
this.handleSearchChange = this.handleSearchChange.bind(this);
|
this.handleSearchChange = this.handleSearchChange.bind(this);
|
||||||
this.handleSearch = this.handleSearch.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') {
|
if (e.key === 'Enter') {
|
||||||
this.handleSearch(e);
|
this.handleSearch(e);
|
||||||
} else if (e.key === 'Escape') {
|
} else if (e.key === 'Escape') {
|
||||||
this.handleClear();
|
e.stopPropagation();
|
||||||
|
this.handleClear(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
render() {
|
render() {
|
||||||
@@ -16639,7 +16667,7 @@ class TheCardMini extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureComp
|
|||||||
className: "org"
|
className: "org"
|
||||||
}, org))), react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
}, org))), react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
||||||
className: "contact-actions"
|
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",
|
className: "flat-button",
|
||||||
"data-val": uid,
|
"data-val": uid,
|
||||||
onClick: this.props.onChatClick
|
onClick: this.props.onChatClick
|
||||||
@@ -16649,21 +16677,21 @@ class TheCardMini extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureComp
|
|||||||
"type": 0,
|
"type": 0,
|
||||||
"value": "Chat"
|
"value": "Chat"
|
||||||
}]
|
}]
|
||||||
})), uid && react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
})), react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
||||||
className: "divider"
|
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",
|
className: "flat-button",
|
||||||
"data-val": contacts.join(','),
|
"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, {
|
}, react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react_intl__WEBPACK_IMPORTED_MODULE_1__.FormattedMessage, {
|
||||||
id: "find_user",
|
id: "find_user",
|
||||||
defaultMessage: [{
|
defaultMessage: [{
|
||||||
"type": 0,
|
"type": 0,
|
||||||
"value": "Find"
|
"value": "Find"
|
||||||
}]
|
}]
|
||||||
})), contacts.length > 0 && react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
})), react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
||||||
className: "divider"
|
className: "divider"
|
||||||
}), react__WEBPACK_IMPORTED_MODULE_0___default().createElement("a", {
|
})) : null, react__WEBPACK_IMPORTED_MODULE_0___default().createElement("a", {
|
||||||
className: "flat-button",
|
className: "flat-button",
|
||||||
onClick: this.handleDownload
|
onClick: this.handleDownload
|
||||||
}, react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react_intl__WEBPACK_IMPORTED_MODULE_1__.FormattedMessage, {
|
}, 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) {
|
||||||
if (nextProps.forwardMessage.content) {
|
if (nextProps.forwardMessage.content) {
|
||||||
|
const content = nextProps.forwardMessage.content;
|
||||||
|
const size = content?.length || content?.size || 0;
|
||||||
nextState.docPreview = {
|
nextState.docPreview = {
|
||||||
object: nextProps.forwardMessage.content,
|
object: content,
|
||||||
type: nextProps.forwardMessage.type
|
type: nextProps.forwardMessage.type,
|
||||||
|
size: size
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
nextState.reply = {
|
nextState.reply = {
|
||||||
@@ -1144,7 +1147,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
}
|
}
|
||||||
sendMessage(msg, uploadCompletionPromise, uploader) {
|
sendMessage(msg, uploadCompletionPromise, uploader) {
|
||||||
let head;
|
let head;
|
||||||
if (this.props.forwardMessage) {
|
if (!msg && this.props.forwardMessage) {
|
||||||
msg = this.props.forwardMessage.msg;
|
msg = this.props.forwardMessage.msg;
|
||||||
head = this.props.forwardMessage.head;
|
head = this.props.forwardMessage.head;
|
||||||
this.handleCancelReply();
|
this.handleCancelReply();
|
||||||
@@ -1178,7 +1181,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
}
|
}
|
||||||
sendFileAttachment(file) {
|
sendFileAttachment(file) {
|
||||||
const maxInbandAttachmentSize = this.props.tinode.getServerParam('maxMessageSize', _config_js__WEBPACK_IMPORTED_MODULE_14__.MAX_INBAND_ATTACHMENT_SIZE) * 0.75 - 1024 | 0;
|
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)) {
|
if (this.sendTheCardAttachment(file, maxInbandAttachmentSize)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1211,6 +1214,11 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
if (file.size > maxInbandAttachmentSize) {
|
if (file.size > maxInbandAttachmentSize) {
|
||||||
return false;
|
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 => {
|
(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));
|
this.sendMessage(tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.appendTheCard(null, card));
|
||||||
}).catch(err => {
|
}).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 _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_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_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); }
|
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) {
|
class BaseChatMessage extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureComponent) {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
@@ -2175,9 +2185,22 @@ class BaseChatMessage extends (react__WEBPACK_IMPORTED_MODULE_0___default().Pure
|
|||||||
this.handleQuoteClick(e);
|
this.handleQuoteClick(e);
|
||||||
break;
|
break;
|
||||||
case 'contact_chat':
|
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':
|
case 'contact_find':
|
||||||
e.preventDefault();
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
console.log('Unhandled drafty action.', action, e.target.dataset);
|
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',
|
tp: 'TC',
|
||||||
data: theCardData
|
data: theCardData
|
||||||
});
|
});
|
||||||
|
console.log('Appended TheCard entity:', content);
|
||||||
return content;
|
return content;
|
||||||
};
|
};
|
||||||
Drafty.UNSAFE_toHTML = function (doc) {
|
Drafty.UNSAFE_toHTML = function (doc) {
|
||||||
@@ -3990,6 +3991,9 @@ class TheCard {
|
|||||||
get contentType() {
|
get contentType() {
|
||||||
return THE_CARD_MIME_TYPE;
|
return THE_CARD_MIME_TYPE;
|
||||||
}
|
}
|
||||||
|
get size() {
|
||||||
|
return JSON.stringify(this).length;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
TheCard.contentType = THE_CARD_MIME_TYPE;
|
TheCard.contentType = THE_CARD_MIME_TYPE;
|
||||||
TheCard.setFn = function (card, fn) {
|
TheCard.setFn = function (card, fn) {
|
||||||
@@ -4669,6 +4673,7 @@ class Topic {
|
|||||||
pub._sending = true;
|
pub._sending = true;
|
||||||
pub._failed = false;
|
pub._failed = false;
|
||||||
let attachments = null;
|
let attachments = null;
|
||||||
|
console.log("Publishing message", pub);
|
||||||
if (_drafty_js__WEBPACK_IMPORTED_MODULE_4___default().hasEntities(pub.content)) {
|
if (_drafty_js__WEBPACK_IMPORTED_MODULE_4___default().hasEntities(pub.content)) {
|
||||||
attachments = [];
|
attachments = [];
|
||||||
_drafty_js__WEBPACK_IMPORTED_MODULE_4___default().entities(pub.content, data => {
|
_drafty_js__WEBPACK_IMPORTED_MODULE_4___default().entities(pub.content, data => {
|
||||||
@@ -7134,6 +7139,7 @@ class Tinode {
|
|||||||
}
|
}
|
||||||
pkt.pub.noecho = noEcho;
|
pkt.pub.noecho = noEcho;
|
||||||
pkt.pub.content = content;
|
pkt.pub.content = content;
|
||||||
|
console.log("Tinode.createMessage", pkt.pub);
|
||||||
return pkt.pub;
|
return pkt.pub;
|
||||||
}
|
}
|
||||||
publish(topicName, content, noEcho) {
|
publish(topicName, content, noEcho) {
|
||||||
@@ -7420,6 +7426,7 @@ Tinode.MAX_FILE_UPLOAD_SIZE = 'maxFileUploadSize';
|
|||||||
Tinode.REQ_CRED_VALIDATORS = 'reqCred';
|
Tinode.REQ_CRED_VALIDATORS = 'reqCred';
|
||||||
Tinode.MSG_DELETE_AGE = 'msgDelAge';
|
Tinode.MSG_DELETE_AGE = 'msgDelAge';
|
||||||
Tinode.URI_TOPIC_ID_PREFIX = 'tinode:topic/';
|
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_ALIAS = _config_js__WEBPACK_IMPORTED_MODULE_1__.TAG_ALIAS;
|
||||||
Tinode.TAG_EMAIL = _config_js__WEBPACK_IMPORTED_MODULE_1__.TAG_EMAIL;
|
Tinode.TAG_EMAIL = _config_js__WEBPACK_IMPORTED_MODULE_1__.TAG_EMAIL;
|
||||||
Tinode.TAG_PHONE = _config_js__WEBPACK_IMPORTED_MODULE_1__.TAG_PHONE;
|
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