Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CodeMirror
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Moritz Aurel Pascal Schubotz
CodeMirror
Commits
2f2fcf92
Commit
2f2fcf92
authored
10 years ago
by
Marijn Haverbeke
Browse files
Options
Downloads
Patches
Plain Diff
[merge addon] Add a revertButtons option to turn off revert buttons
Closes #2754
parent
0d45a4d1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
addon/merge/merge.js
+19
-13
19 additions, 13 deletions
addon/merge/merge.js
doc/manual.html
+3
-1
3 additions, 1 deletion
doc/manual.html
with
22 additions
and
14 deletions
addon/merge/merge.js
+
19
−
13
View file @
2f2fcf92
...
...
@@ -71,7 +71,7 @@
function
update
(
mode
)
{
if
(
mode
==
"
full
"
)
{
if
(
dv
.
svg
)
clear
(
dv
.
svg
);
clear
(
dv
.
copyButtons
);
if
(
dv
.
copyButtons
)
clear
(
dv
.
copyButtons
);
clearMarks
(
dv
.
edit
,
edit
.
marked
,
dv
.
classes
);
clearMarks
(
dv
.
orig
,
orig
.
marked
,
dv
.
classes
);
edit
.
from
=
edit
.
to
=
orig
.
from
=
orig
.
to
=
0
;
...
...
@@ -257,7 +257,7 @@
var
w
=
dv
.
gap
.
offsetWidth
;
attrs
(
dv
.
svg
,
"
width
"
,
w
,
"
height
"
,
dv
.
gap
.
offsetHeight
);
}
clear
(
dv
.
copyButtons
);
if
(
dv
.
copyButtons
)
clear
(
dv
.
copyButtons
);
var
flip
=
dv
.
type
==
"
left
"
;
var
vpEdit
=
dv
.
edit
.
getViewport
(),
vpOrig
=
dv
.
orig
.
getViewport
();
...
...
@@ -279,11 +279,13 @@
"
d
"
,
"
M -1
"
+
topRpx
+
curveTop
+
"
L
"
+
(
w
+
2
)
+
"
"
+
botLpx
+
curveBot
+
"
z
"
,
"
class
"
,
dv
.
classes
.
connect
);
}
var
copy
=
dv
.
copyButtons
.
appendChild
(
elt
(
"
div
"
,
dv
.
type
==
"
left
"
?
"
\
u21dd
"
:
"
\
u21dc
"
,
"
CodeMirror-merge-copy
"
));
copy
.
title
=
"
Revert chunk
"
;
copy
.
chunk
=
{
topEdit
:
topEdit
,
botEdit
:
botEdit
,
topOrig
:
topOrig
,
botOrig
:
botOrig
};
copy
.
style
.
top
=
top
+
"
px
"
;
if
(
dv
.
copyButtons
)
{
var
copy
=
dv
.
copyButtons
.
appendChild
(
elt
(
"
div
"
,
dv
.
type
==
"
left
"
?
"
\
u21dd
"
:
"
\
u21dc
"
,
"
CodeMirror-merge-copy
"
));
copy
.
title
=
"
Revert chunk
"
;
copy
.
chunk
=
{
topEdit
:
topEdit
,
botEdit
:
botEdit
,
topOrig
:
topOrig
,
botOrig
:
botOrig
};
copy
.
style
.
top
=
top
+
"
px
"
;
}
});
}
...
...
@@ -298,6 +300,7 @@
var
MergeView
=
CodeMirror
.
MergeView
=
function
(
node
,
options
)
{
if
(
!
(
this
instanceof
MergeView
))
return
new
MergeView
(
node
,
options
);
this
.
options
=
options
;
var
origLeft
=
options
.
origLeft
,
origRight
=
options
.
origRight
==
null
?
options
.
orig
:
options
.
origRight
;
var
hasLeft
=
origLeft
!=
null
,
hasRight
=
origRight
!=
null
;
var
panes
=
1
+
(
hasLeft
?
1
:
0
)
+
(
hasRight
?
1
:
0
);
...
...
@@ -345,12 +348,15 @@
lock
.
title
=
"
Toggle locked scrolling
"
;
var
lockWrap
=
elt
(
"
div
"
,
[
lock
],
"
CodeMirror-merge-scrolllock-wrap
"
);
CodeMirror
.
on
(
lock
,
"
click
"
,
function
()
{
setScrollLock
(
dv
,
!
dv
.
lockScroll
);
});
dv
.
copyButtons
=
elt
(
"
div
"
,
null
,
"
CodeMirror-merge-copybuttons-
"
+
dv
.
type
);
CodeMirror
.
on
(
dv
.
copyButtons
,
"
click
"
,
function
(
e
)
{
var
node
=
e
.
target
||
e
.
srcElement
;
if
(
node
.
chunk
)
copyChunk
(
dv
,
node
.
chunk
);
});
var
gapElts
=
[
dv
.
copyButtons
,
lockWrap
];
var
gapElts
=
[
lockWrap
];
if
(
dv
.
mv
.
options
.
revertButtons
!==
false
)
{
dv
.
copyButtons
=
elt
(
"
div
"
,
null
,
"
CodeMirror-merge-copybuttons-
"
+
dv
.
type
);
CodeMirror
.
on
(
dv
.
copyButtons
,
"
click
"
,
function
(
e
)
{
var
node
=
e
.
target
||
e
.
srcElement
;
if
(
node
.
chunk
)
copyChunk
(
dv
,
node
.
chunk
);
});
gapElts
.
unshift
(
dv
.
copyButtons
);
}
var
svg
=
document
.
createElementNS
&&
document
.
createElementNS
(
svgNS
,
"
svg
"
);
if
(
svg
&&
!
svg
.
createSVGRect
)
svg
=
null
;
dv
.
svg
=
svg
;
...
...
This diff is collapsed.
Click to expand it.
doc/manual.html
+
3
−
1
View file @
2f2fcf92
...
...
@@ -2632,7 +2632,9 @@
document, which will be shown to the left and right of the
editor in non-editable CodeMirror instances. The merge interface
will highlight changes between the editable document and the
original(s) (
<a
href=
"../demo/merge.html"
>
demo
</a>
).
</dd>
original(s), and, unless a
<code>
revertButtons
</code>
option
of
<code>
false
</code>
is given, show buttons that allow the user
to revert changes (
<a
href=
"../demo/merge.html"
>
demo
</a>
).
</dd>
<dt
id=
"addon_tern"
><a
href=
"../addon/tern/tern.js"
><code>
tern/tern.js
</code></a></dt>
<dd>
Provides integration with
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment