mjs nodejs support
This commit is contained in:
@@ -4,14 +4,14 @@
|
||||
|
||||
/* global MutationObserver, getSelection */
|
||||
|
||||
import { fromRelativePosition } from '../../utils/relativePosition.js'
|
||||
import { createMutex } from '../../lib/mutex.js'
|
||||
import { createAssociation, removeAssociation } from './util.js'
|
||||
import { beforeTransactionSelectionFixer, afterTransactionSelectionFixer, getCurrentRelativeSelection } from './selection.js'
|
||||
import { defaultFilter, applyFilterOnType } from './filter.js'
|
||||
import { typeObserver } from './typeObserver.js'
|
||||
import { domObserver } from './domObserver.js'
|
||||
import { YXmlFragment } from '../../types/YXmlElement.js' // eslint-disable-line
|
||||
import { fromRelativePosition } from '../../utils/relativePosition.mjs'
|
||||
import { createMutex } from '../../lib/mutex.mjs'
|
||||
import { createAssociation, removeAssociation } from './util.mjs'
|
||||
import { beforeTransactionSelectionFixer, afterTransactionSelectionFixer, getCurrentRelativeSelection } from './selection.mjs'
|
||||
import { defaultFilter, applyFilterOnType } from './filter.mjs'
|
||||
import { typeObserver } from './typeObserver.mjs'
|
||||
import { domObserver } from './domObserver.mjs'
|
||||
import { YXmlFragment } from '../../types/YXmlElement.mjs' // eslint-disable-line
|
||||
|
||||
/**
|
||||
* @callback DomFilter
|
||||
@@ -2,13 +2,13 @@
|
||||
* @module bindings/dom
|
||||
*/
|
||||
|
||||
import { YXmlHook } from '../../types/YXmlHook.js'
|
||||
import { YXmlHook } from '../../types/YXmlHook.mjs'
|
||||
import {
|
||||
iterateUntilUndeleted,
|
||||
removeAssociation,
|
||||
insertNodeHelper } from './util.js'
|
||||
import { simpleDiff } from '../../lib/diff.js'
|
||||
import { YXmlFragment } from '../../types/YXmlElement.js'
|
||||
insertNodeHelper } from './util.mjs'
|
||||
import { simpleDiff } from '../../lib/diff.mjs'
|
||||
import { YXmlFragment } from '../../types/YXmlElement.mjs'
|
||||
|
||||
/**
|
||||
* 1. Check if any of the nodes was deleted
|
||||
@@ -3,12 +3,12 @@
|
||||
*/
|
||||
|
||||
/* eslint-env browser */
|
||||
import { YXmlText } from '../../types/YXmlText.js'
|
||||
import { YXmlHook } from '../../types/YXmlHook.js'
|
||||
import { YXmlElement } from '../../types/YXmlElement.js'
|
||||
import { createAssociation, domsToTypes } from './util.js'
|
||||
import { filterDomAttributes, defaultFilter } from './filter.js'
|
||||
import { DomBinding } from './DomBinding.js' // eslint-disable-line
|
||||
import { YXmlText } from '../../types/YXmlText.mjs'
|
||||
import { YXmlHook } from '../../types/YXmlHook.mjs'
|
||||
import { YXmlElement } from '../../types/YXmlElement.mjs'
|
||||
import { createAssociation, domsToTypes } from './util.mjs'
|
||||
import { filterDomAttributes, defaultFilter } from './filter.mjs'
|
||||
import { DomBinding } from './DomBinding.mjs' // eslint-disable-line
|
||||
|
||||
/**
|
||||
* @callback DomFilter
|
||||
@@ -2,9 +2,10 @@
|
||||
* @module bindings/dom
|
||||
*/
|
||||
|
||||
import { isParentOf } from '../../utils/isParentOf.js'
|
||||
import * as Y from '../../index.js'
|
||||
import { DomBinding } from './DomBinding.js' // eslint-disable-line
|
||||
import { Y } from '../../utils/Y.mjs' // eslint-disable-line
|
||||
import { YXmlElement, YXmlFragment } from '../../types/YXmlElement.mjs' // eslint-disable-line
|
||||
import { isParentOf } from '../../utils/isParentOf.mjs'
|
||||
import { DomBinding } from './DomBinding.mjs' // eslint-disable-line
|
||||
|
||||
/**
|
||||
* Default filter method (does nothing).
|
||||
@@ -34,14 +35,14 @@ export const filterDomAttributes = (dom, filter) => {
|
||||
/**
|
||||
* Applies a filter on a type.
|
||||
*
|
||||
* @param {Y.Y} y The Yjs instance.
|
||||
* @param {Y} y The Yjs instance.
|
||||
* @param {DomBinding} binding The DOM binding instance that has the dom filter.
|
||||
* @param {Y.XmlElement | Y.XmlFragment } type The type to apply the filter to.
|
||||
* @param {YXmlElement | YXmlFragment } type The type to apply the filter to.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
export const applyFilterOnType = (y, binding, type) => {
|
||||
if (isParentOf(binding.type, type) && type instanceof Y.XmlElement) {
|
||||
if (isParentOf(binding.type, type) && type instanceof YXmlElement) {
|
||||
const nodeName = type.nodeName
|
||||
let attributes = new Map()
|
||||
if (type.getAttributes !== undefined) {
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
/* globals getSelection */
|
||||
|
||||
import { getRelativePosition } from '../../utils/relativePosition.js'
|
||||
import { getRelativePosition } from '../../utils/relativePosition.mjs'
|
||||
|
||||
let relativeSelection = null
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
/* eslint-env browser */
|
||||
/* global getSelection */
|
||||
|
||||
import { YXmlText } from '../../types/YXmlText.js'
|
||||
import { YXmlHook } from '../../types/YXmlHook.js'
|
||||
import { removeDomChildrenUntilElementFound } from './util.js'
|
||||
import { YXmlText } from '../../types/YXmlText.mjs'
|
||||
import { YXmlHook } from '../../types/YXmlHook.mjs'
|
||||
import { removeDomChildrenUntilElementFound } from './util.mjs'
|
||||
|
||||
const findScrollReference = scrollingElement => {
|
||||
if (scrollingElement !== null) {
|
||||
@@ -2,11 +2,8 @@
|
||||
* @module bindings/dom
|
||||
*/
|
||||
|
||||
import { domToType } from './domToType.js'
|
||||
import { DomBinding } from './DomBinding.js' // eslint-disable-line
|
||||
import { YXmlHook } from '../../types/YXmlHook.js' // eslint-disable-line
|
||||
import { YXmlText } from '../../types/YXmlText.js' // eslint-disable-line
|
||||
import { YXmlElement, YXmlFragment } from '../../types/YXmlElement.js' // eslint-disable-line
|
||||
import { domToType } from './domToType.mjs'
|
||||
import { DomBinding } from './DomBinding.mjs' // eslint-disable-line
|
||||
|
||||
/**
|
||||
* Iterates items until an undeleted item is found.
|
||||
Reference in New Issue
Block a user