"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "packages/common/src/global-plugins.ts" between
fullcalendar-5.9.0.tar.gz and fullcalendar-5.10.0.tar.gz

About: FullCalendar is a full-sized drag & drop JavaScript event calendar.

global-plugins.ts  (fullcalendar-5.9.0):global-plugins.ts  (fullcalendar-5.10.0)
skipping to change at line 30 skipping to change at line 30
arrayEventSourcePlugin, arrayEventSourcePlugin,
funcEventSourcePlugin, funcEventSourcePlugin,
jsonFeedEventSourcePlugin, jsonFeedEventSourcePlugin,
simpleRecurringEventsPlugin, simpleRecurringEventsPlugin,
changeHandlerPlugin, changeHandlerPlugin,
createPlugin({ // misc... createPlugin({ // misc...
isLoadingFuncs: [ isLoadingFuncs: [
(state: CalendarDataManagerState) => computeEventSourcesLoading(state.even tSources), (state: CalendarDataManagerState) => computeEventSourcesLoading(state.even tSources),
], ],
contentTypeHandlers: { contentTypeHandlers: {
html: () => ({ render: injectHtml }), html: buildHtmlRenderer,
domNodes: () => ({ render: injectDomNodes }), domNodes: buildDomNodeRenderer,
}, },
propSetHandlers: { propSetHandlers: {
dateProfile: handleDateProfile, dateProfile: handleDateProfile,
eventStore: handleEventStore, eventStore: handleEventStore,
}, },
}), }),
] ]
export function injectHtml(el: HTMLElement, html: string) { function buildHtmlRenderer() {
el.innerHTML = html let currentEl: HTMLElement | null = null
let currentHtml: string = ''
function render(el: HTMLElement, html: string) {
if (el !== currentEl || html !== currentHtml) {
el.innerHTML = html
}
currentEl = el
currentHtml = html
}
function destroy() {
currentEl.innerHTML = ''
currentEl = null
currentHtml = ''
}
return { render, destroy }
} }
export function injectDomNodes(el: HTMLElement, domNodes: Node[] | NodeList) { function buildDomNodeRenderer() {
let oldNodes = Array.prototype.slice.call(el.childNodes) // TODO: use array ut let currentEl: HTMLElement | null = null
il let currentDomNodes: Node[] = []
let newNodes = Array.prototype.slice.call(domNodes) // TODO: use array util
function render(el: HTMLElement, domNodes: Node[] | NodeList) {
if (!isArraysEqual(oldNodes, newNodes)) { let newDomNodes = Array.prototype.slice.call(domNodes)
for (let newNode of newNodes) {
el.appendChild(newNode) if (el !== currentEl || !isArraysEqual(currentDomNodes, newDomNodes)) {
// append first, remove second (for scroll resetting)
for (let newNode of newDomNodes) {
el.appendChild(newNode)
}
destroy()
} }
oldNodes.forEach(removeElement)
currentEl = el
currentDomNodes = newDomNodes
} }
function destroy() {
currentDomNodes.forEach(removeElement)
currentDomNodes = []
currentEl = null
}
return { render, destroy }
} }
 End of changes. 5 change blocks. 
13 lines changed or deleted 45 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)