mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
remove callout widget from ranges extension
GitOrigin-RevId: fa7f36cb0270228b57162404ce5a17523790e396
This commit is contained in:
parent
be47b27d98
commit
ea20f82ad6
1 changed files with 2 additions and 79 deletions
|
@ -142,37 +142,6 @@ class ChangeDeletedWidget extends WidgetType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ChangeCalloutWidget extends WidgetType {
|
|
||||||
constructor(
|
|
||||||
public change: Change,
|
|
||||||
public opType: string
|
|
||||||
) {
|
|
||||||
super()
|
|
||||||
}
|
|
||||||
|
|
||||||
toDOM() {
|
|
||||||
const widget = document.createElement('span')
|
|
||||||
widget.className = 'ol-cm-change-callout'
|
|
||||||
widget.classList.add(`ol-cm-change-callout-${this.opType}`)
|
|
||||||
|
|
||||||
const inner = document.createElement('span')
|
|
||||||
inner.classList.add('ol-cm-change-callout-inner')
|
|
||||||
widget.appendChild(inner)
|
|
||||||
|
|
||||||
return widget
|
|
||||||
}
|
|
||||||
|
|
||||||
eq(widget: ChangeCalloutWidget) {
|
|
||||||
return widget.opType === this.opType
|
|
||||||
}
|
|
||||||
|
|
||||||
updateDOM(element: HTMLElement) {
|
|
||||||
element.className = 'ol-cm-change-callout'
|
|
||||||
element.classList.add(`ol-cm-change-callout-${this.opType}`)
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const createChangeRange = (change: Change, data: RangesData) => {
|
const createChangeRange = (change: Change, data: RangesData) => {
|
||||||
const { id, metadata, op } = change
|
const { id, metadata, op } = change
|
||||||
|
|
||||||
|
@ -190,15 +159,7 @@ const createChangeRange = (change: Change, data: RangesData) => {
|
||||||
metadata,
|
metadata,
|
||||||
})
|
})
|
||||||
|
|
||||||
const calloutWidget = Decoration.widget({
|
return [changeWidget.range(from, from)]
|
||||||
widget: new ChangeCalloutWidget(change, opType),
|
|
||||||
side: 1,
|
|
||||||
opType,
|
|
||||||
id,
|
|
||||||
metadata,
|
|
||||||
})
|
|
||||||
|
|
||||||
return [calloutWidget.range(from, from), changeWidget.range(from, from)]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const _isCommentOperation = isCommentOperation(op)
|
const _isCommentOperation = isCommentOperation(op)
|
||||||
|
@ -227,14 +188,7 @@ const createChangeRange = (change: Change, data: RangesData) => {
|
||||||
metadata,
|
metadata,
|
||||||
})
|
})
|
||||||
|
|
||||||
const calloutWidget = Decoration.widget({
|
return [changeMark.range(from, to)]
|
||||||
widget: new ChangeCalloutWidget(change, opType),
|
|
||||||
opType,
|
|
||||||
id,
|
|
||||||
metadata,
|
|
||||||
})
|
|
||||||
|
|
||||||
return [calloutWidget.range(from, from), changeMark.range(from, to)]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -339,9 +293,6 @@ export const rejectChanges = (
|
||||||
}
|
}
|
||||||
|
|
||||||
const trackChangesTheme = EditorView.baseTheme({
|
const trackChangesTheme = EditorView.baseTheme({
|
||||||
'.cm-line': {
|
|
||||||
overflowX: 'hidden', // needed so the callout elements don't overflow (requires line wrapping to be on)
|
|
||||||
},
|
|
||||||
'&light .ol-cm-change-i': {
|
'&light .ol-cm-change-i': {
|
||||||
backgroundColor: '#2c8e304d',
|
backgroundColor: '#2c8e304d',
|
||||||
},
|
},
|
||||||
|
@ -361,32 +312,4 @@ const trackChangesTheme = EditorView.baseTheme({
|
||||||
borderLeft: '2px dotted #c5060b',
|
borderLeft: '2px dotted #c5060b',
|
||||||
marginLeft: '-1px',
|
marginLeft: '-1px',
|
||||||
},
|
},
|
||||||
'.ol-cm-change-callout': {
|
|
||||||
position: 'relative',
|
|
||||||
pointerEvents: 'none',
|
|
||||||
padding: 'var(--half-leading, 0) 0',
|
|
||||||
},
|
|
||||||
'.ol-cm-change-callout-inner': {
|
|
||||||
display: 'inline-block',
|
|
||||||
position: 'absolute',
|
|
||||||
left: 0,
|
|
||||||
bottom: 0,
|
|
||||||
width: '100vw',
|
|
||||||
borderBottom: '1px dashed black',
|
|
||||||
},
|
|
||||||
// disable callout line in Firefox
|
|
||||||
'@supports (-moz-appearance:none)': {
|
|
||||||
'.ol-cm-change-callout-inner': {
|
|
||||||
display: 'none',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'.ol-cm-change-callout-i .ol-cm-change-callout-inner': {
|
|
||||||
borderColor: '#2c8e30',
|
|
||||||
},
|
|
||||||
'.ol-cm-change-callout-c .ol-cm-change-callout-inner': {
|
|
||||||
borderColor: '#f3b111',
|
|
||||||
},
|
|
||||||
'.ol-cm-change-callout-d .ol-cm-change-callout-inner': {
|
|
||||||
borderColor: '#c5060b',
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue