How to use the tui-code-snippet.browser function in tui-code-snippet

To help you get started, weโ€™ve selected a few tui-code-snippet 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 nhn / tui.grid / src / js / view / rowList.js View on Github external
* @private
     */
    _onModelRestore: function(cellData) {
        var $td = this.dataModel.getElement(cellData.rowKey, cellData.columnName);
        var editType = this.columnModel.getEditType(cellData.columnName);

        this.painterManager.getCellPainter(editType).refresh(cellData, $td);
        this.coordRowModel.syncWithDom();
    }
}, {
    /**
     * Whether the innerHTML property of a tbody element is readonly.
     * @memberof RowList
     * @static
     */
    isInnerHtmlOfTbodyReadOnly: (snippet.browser.msie &&
        snippet.browser.version <= 9) // eslint-disable-line no-magic-numbers
});

module.exports = RowList;
github nhn / tui.editor / src / js / wwTableSelectionManager.js View on Github external
const onMouseover = ev => {
      selectionEnd = $(ev.data.target).closest('[contenteditable=true] td,th').get(0);

      const range = this.wwe.getEditor().getSelection();
      const isEndsInTable = $(selectionEnd).parents('[contenteditable=true] table').get(0);
      const isSameCell = selectionStart === selectionEnd;
      const isTextSelect = this._isTextSelect(range, isSameCell) &&
                  !$(selectionStart).hasClass(TABLE_CELL_SELECTED_CLASS_NAME);

      if (this._isSelectionStarted && isEndsInTable && !isTextSelect) {
        window.getSelection().removeAllRanges();
        // For disable firefox's native table cell selection
        if (util.browser.firefox && !this._removeSelectionTimer) {
          this._removeSelectionTimer = setInterval(() => {
            window.getSelection().removeAllRanges();
          }, 10);
        }
        this.highlightTableCellsBy(selectionStart, selectionEnd);
        validSelectionEnd = selectionEnd;
      }
    };
github nhn / tui.calendar / src / js / handler / time / moveGuide.js View on Github external
TimeMoveGuide.prototype._onDrag = function(dragEventData) {
    var timeView = dragEventData.currentView,
        viewOptions = timeView.options,
        viewHeight = timeView.getViewBound().height,
        guideHeight = parseFloat(this.guideElement.style.height),
        hourLength = viewOptions.hourEnd - viewOptions.hourStart,
        gridYOffset = dragEventData.nearestGridY - this._startGridY,
        gridYOffsetPixel = ratio(hourLength, viewHeight, gridYOffset),
        timeDiff = dragEventData.nearestGridTimeY - this._lastDrag.nearestGridTimeY,
        bottomLimit,
        top;

    if (!util.browser.msie) {
        domutil.addClass(global.document.body, config.classname('dragging'));
    }

    if (this._container !== timeView.container) {
        this._container = timeView.container;
        this._resetGuideLayer();
    }

    top = this._startTopPixel + gridYOffsetPixel;
    bottomLimit = viewHeight - guideHeight;

    top = Math.max(top, 0);
    top = Math.min(top, bottomLimit);

    // update time
    this._model.start = new TZDate(this._model.getStarts().getTime() + timeDiff);
github nhn / tui.calendar / src / js / handler / time / move.js View on Github external
TimeMove.prototype._onMouseDown = function(mouseDownEventData) {
    var target = mouseDownEventData.target,
        timeView = this.checkExpectCondition(target),
        blockElement = domutil.closest(target, config.classname('.time-date-schedule-block'));

    if (!timeView || !blockElement) {
        return;
    }

    // EventTarget.target is not changed in mousemove event even if mouse is over the other element.
    // It's different with other browsers(IE, Chrome, Safari)
    if (util.browser.firefox) {
        domevent.preventDefault(mouseDownEventData.originEvent);
    }
};
github nhn / tui.editor / src / js / wwTableSelectionManager.js View on Github external
this._clearTableSelectionTimerIfNeed();

      if (this._isSelectionStarted) {
        if (isTextSelect || this._isListSelect(range)) {
          this.removeClassAttrbuteFromAllCellsIfNeed();
        } else {
          this.wwe.componentManager.getManager('table').resetLastCellNode();

          selectionEnd = selectionEnd || validSelectionEnd;

          range = this.wwe.getEditor().getSelection();
          range.setStart(selectionEnd, 0);
          // IE wont fire copy/cut event if there is no selected range.
          // trick IE to fire the event
          if (util.browser.msie) {
            range.setEnd(selectionEnd, 1);
          } else {
            range.setEnd(selectionEnd, 0);
            range.collapse(false);
          }
          this.wwe.getEditor().setSelection(range);
        }
        if (this.onDragEnd) {
          this.onDragEnd();
        }
      }

      finishSelection();
    };
github nhn / tui.editor / src / js / wysiwygEditor.js View on Github external
source: 'wysiwyg',
        data: clipboardEvent
      });
      util.debounce(() => {
        if (!this.isEditorValid()) {
          return;
        }

        this.eventManager.emit('cutAfter', {
          source: 'wysiwyg',
          data: clipboardEvent
        });
      })();
    });

    squire.addEventListener(util.browser.msie ? 'beforepaste' : 'paste', clipboardEvent => {
      this.eventManager.emit('paste', {
        source: 'wysiwyg',
        data: clipboardEvent
      });
    });

    squire.addEventListener('dragover', ev => {
      ev.preventDefault();

      return false;
    });

    squire.addEventListener('drop', ev => {
      ev.preventDefault();

      this.eventManager.emit('drop', {
github nhn / tui.calendar / src / js / handler / month / moveGuide.js View on Github external
layer.setSize(widthPercent + '%', height);
    layer.setPosition(mousePos[0], mousePos[1]);
    layer.setContent(tmpl({
        model: util.extend(
            Schedule.create(model),
            model
        ),
        styles: {
            scheduleHeight: weekdayOptions.scheduleHeight,
            scheduleBulletTop: weekdayOptions.scheduleHeight / 3,
            borderRadius: monthView.controller.theme.month.schedule.borderRadius
        }
    }));
    layer.show();

    if (!util.browser.msie) {
        domutil.addClass(global.document.body, config.classname('dragging'));
    }
};
github nhn / tui.calendar / src / js / handler / daygrid / resizeGuide.js View on Github external
DayGridResizeGuide.prototype._onDragStart = function(dragStartEventData) {
    var container = this.resizeHandler.view.container,
        scheduleBlockElement = this.scheduleBlockElement = dragStartEventData.scheduleBlockElement,
        guideElement = this.guideElement = scheduleBlockElement.cloneNode(true),
        scheduleContainer;

    if (!util.browser.msie) {
        domutil.addClass(global.document.body, config.classname('resizing-x'));
    }

    scheduleContainer = domutil.find(config.classname('.weekday-schedules'), container);
    domutil.addClass(guideElement, config.classname('daygrid-guide-move'));
    domutil.addClass(scheduleBlockElement, config.classname('weekday-schedule-block-dragging-dim'));

    scheduleContainer.appendChild(guideElement);

    this.getScheduleDataFunc = this.getGuideElementWidthFunc(dragStartEventData);
};
github nhn / tui.editor / src / js / extensions / table / tableDataHandler.js View on Github external
* @ignore
 */
function createRenderData(tableData, cellIndexData) {
  const headerAligns = _getHeaderAligns(tableData);
  const renderData = cellIndexData.map(row => row.map(({rowIndex, colIndex}) => (util.extend({
    align: headerAligns[colIndex]
  }, tableData[rowIndex][colIndex]))));

  if (tableData.className) {
    renderData.className = tableData.className;
  }

  return renderData;
}

const BASIC_CELL_CONTENT = util.browser.msie ? '' : '<br>';

/**
 * Create basic cell data.
 * @param {number} rowIndex - row index
 * @param {number} colIndex - column index
 * @param {string} nodeName - node name
 * @returns {{
 *   nodeName: string,
 *   colspan: number,
 *   rowspan: number,
 *   content: string
 * }}
 * @ignore
 */
function createBasicCell(rowIndex, colIndex, nodeName) {
  return {
github nhn / tui.calendar / src / js / handler / month / resizeGuide.js View on Github external
MonthResizeGuide.prototype._onDragStart = function(dragStartEvent) {
    this.guide = new MonthGuide({
        isResizeMode: true
    }, this.monthResize.monthView);

    this._hideScheduleBlocks(dragStartEvent.model.cid());

    this.guide.start(dragStartEvent);

    if (!util.browser.msie) {
        domutil.addClass(global.document.body, config.classname('resizing-x'));
    }
};