How to use the tinode-sdk.Drafty function in tinode-sdk

To help you get started, we’ve selected a few tinode-sdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tinode / webapp / src / views / tinode-web.jsx View on Github external
handleReportTopic(topicName) {
    const topic = this.tinode.getTopic(topicName);
    if (!topic) {
      return;
    }

    // Publish spam report.
    this.tinode.publish(Tinode.TOPIC_SYS, Tinode.Drafty.attachJSON(null, {
      'action': 'report',
      'target': topicName
    }));

    // Remove J and P permissions.
    topic.updateMode(null, '-JP').then((ctrl) => {
      // Hide MessagesView and InfoView panels.
      HashNavigation.navigateTo(HashNavigation.setUrlTopic(window.location.hash, ''));
    }).catch((err) => {
      this.handleError(err.message, 'err');
    });
  }
github tinode / webapp / src / webapp.jsx View on Github external
if (typeof require == 'function') {
  if (typeof React == 'undefined') {
    var React = require('react');
    var ReactDOM = require('react-dom');
  }
  if (typeof Tinode == 'undefined') {
    var Tinode = require('tinode-sdk');
    var Drafty = Tinode.Drafty;
  }
  if (typeof firebase == 'undefined') {
    var firebase = require('firebase/app');
    require('firebase/messaging');
  }
  if (typeof ReactIntl == 'undefined') {
    var ReactIntl = require('react-intl');
    var {IntlProvider, FormattedMessage} = ReactIntl;
  }
  var package_version = require('../version.json').version;
}
github tinode / webapp / src / views / messages-view.jsx View on Github external
import React from 'react';
import { FormattedMessage, defineMessages, injectIntl } from 'react-intl';

import Tinode from 'tinode-sdk';
const Drafty = Tinode.Drafty;

import ChatMessage from '../widgets/chat-message.jsx';
import ErrorPanel from '../widgets/error-panel.jsx';
import GroupSubs from '../widgets/group-subs.jsx';
import ImagePreview from '../widgets/image-preview.jsx';
import Invitation from '../widgets/Invitation.jsx';
import LetterTile from '../widgets/letter-tile.jsx';
import LoadSpinner from '../widgets/load-spinner.jsx';
import LogoView from './logo-view.jsx';
import SendMessage from '../widgets/send-message.jsx';

import { DEFAULT_P2P_ACCESS_MODE, KEYPRESS_DELAY, MESSAGES_PAGE } from '../config.js';
import { makeImageUrl } from '../lib/blob-helpers.js';
import { shortDateFormat } from '../lib/strformat.js';

const messages = defineMessages({