Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Stud.IP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jan-Hendrik Willms
Stud.IP
Commits
2f59e2f7
Commit
2f59e2f7
authored
2 years ago
by
Marcus Eibrink-Lunzenauer
Committed by
Jan-Hendrik Willms
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Disable StudipBlockQuoteIcons while source editing, fixes #1515
Closes #1515 Merge request
studip/studip!978
parent
decca106
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
resources/assets/javascripts/cke/studip-quote/StudipBlockQuote.js
+33
-23
33 additions, 23 deletions
...s/assets/javascripts/cke/studip-quote/StudipBlockQuote.js
with
33 additions
and
23 deletions
resources/assets/javascripts/cke/studip-quote/StudipBlockQuote.js
+
33
−
23
View file @
2f59e2f7
import
Plugin
from
'
@ckeditor/ckeditor5-core/src/plugin
'
;
import
Plugin
from
'
@ckeditor/ckeditor5-core/src/plugin
'
;
import
ButtonView
from
'
@ckeditor/ckeditor5-ui/src/button/buttonview
'
;
import
ButtonView
from
'
@ckeditor/ckeditor5-ui/src/button/buttonview
'
;
import
{
$gettext
}
from
'
../../lib/gettext.js
'
;
import
{
$gettext
}
from
'
../../lib/gettext.js
'
;
import
{
icons
}
from
'
ckeditor5/src/core
'
;
import
{
Command
,
icons
}
from
'
ckeditor5/src/core
'
;
const
divideIcon
=
const
divideIcon
=
'
<svg version="1.1" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m9.3 2h2v16h-2zm-7.2987 8.423a6.5 6.5 0 0 1 6.056-6.408l0.038 0.67c-2.646 0.738-3.74 2.978-3.874 5.315h3.78c0.552 0 0.5 0.432 0.5 0.986v4.511c0 0.554-0.448 0.503-1 0.503h-5c-0.552 0-0.5-0.449-0.5-1.003zm10 0a6.5 6.5 0 0 1 6.056-6.408l0.038 0.67c-2.646 0.739-3.74 2.979-3.873 5.315h3.779c0.552 0 0.5 0.432 0.5 0.986v4.511c0 0.554-0.448 0.503-1 0.503h-5c-0.552 0-0.5-0.449-0.5-1.003z" stroke-width="1.1664"/></svg>
'
;
'
<svg version="1.1" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m9.3 2h2v16h-2zm-7.2987 8.423a6.5 6.5 0 0 1 6.056-6.408l0.038 0.67c-2.646 0.738-3.74 2.978-3.874 5.315h3.78c0.552 0 0.5 0.432 0.5 0.986v4.511c0 0.554-0.448 0.503-1 0.503h-5c-0.552 0-0.5-0.449-0.5-1.003zm10 0a6.5 6.5 0 0 1 6.056-6.408l0.038 0.67c-2.646 0.739-3.74 2.979-3.873 5.315h3.779c0.552 0 0.5 0.432 0.5 0.986v4.511c0 0.554-0.448 0.503-1 0.503h-5c-0.552 0-0.5-0.449-0.5-1.003z" stroke-width="1.1664"/></svg>
'
;
...
@@ -13,6 +13,10 @@ export default class StudipBlockQuote extends Plugin {
...
@@ -13,6 +13,10 @@ export default class StudipBlockQuote extends Plugin {
init
()
{
init
()
{
const
editor
=
this
.
editor
;
const
editor
=
this
.
editor
;
editor
.
commands
.
add
(
'
insertStudipQuote
'
,
new
InsertStudipQuoteCommand
(
editor
));
editor
.
commands
.
add
(
'
splitStudipQuote
'
,
new
SplitStudipQuoteCommand
(
editor
));
editor
.
commands
.
add
(
'
removeStudipQuote
'
,
new
RemoveStudipQuoteCommand
(
editor
));
editor
.
ui
.
componentFactory
.
add
(
'
insertBlockQuote
'
,
(
locale
)
=>
{
editor
.
ui
.
componentFactory
.
add
(
'
insertBlockQuote
'
,
(
locale
)
=>
{
const
view
=
new
ButtonView
(
locale
);
const
view
=
new
ButtonView
(
locale
);
...
@@ -22,9 +26,12 @@ export default class StudipBlockQuote extends Plugin {
...
@@ -22,9 +26,12 @@ export default class StudipBlockQuote extends Plugin {
tooltip
:
true
,
tooltip
:
true
,
});
});
const
command
=
editor
.
commands
.
get
(
'
removeStudipQuote
'
);
view
.
bind
(
'
isEnabled
'
).
to
(
command
,
'
isEnabled
'
);
// Callback executed once the image is clicked.
// Callback executed once the image is clicked.
view
.
on
(
'
execute
'
,
()
=>
{
view
.
on
(
'
execute
'
,
()
=>
{
this
.
insertStudipQuote
(
editor
);
editor
.
execute
(
'
insertStudipQuote
'
);
});
});
return
view
;
return
view
;
...
@@ -41,9 +48,12 @@ export default class StudipBlockQuote extends Plugin {
...
@@ -41,9 +48,12 @@ export default class StudipBlockQuote extends Plugin {
withText
:
false
,
withText
:
false
,
});
});
const
command
=
editor
.
commands
.
get
(
'
removeStudipQuote
'
);
view
.
bind
(
'
isEnabled
'
).
to
(
command
,
'
isEnabled
'
);
// Callback executed once the image is clicked.
// Callback executed once the image is clicked.
view
.
on
(
'
execute
'
,
()
=>
{
view
.
on
(
'
execute
'
,
()
=>
{
this
.
splitStudipQuote
(
editor
);
editor
.
execute
(
'
splitStudipQuote
'
);
});
});
return
view
;
return
view
;
...
@@ -59,55 +69,55 @@ export default class StudipBlockQuote extends Plugin {
...
@@ -59,55 +69,55 @@ export default class StudipBlockQuote extends Plugin {
withText
:
false
,
withText
:
false
,
});
});
const
command
=
editor
.
commands
.
get
(
'
removeStudipQuote
'
);
view
.
bind
(
'
isEnabled
'
).
to
(
command
,
'
isEnabled
'
);
// Callback executed once the image is clicked.
// Callback executed once the image is clicked.
view
.
on
(
'
execute
'
,
()
=>
{
view
.
on
(
'
execute
'
,
()
=>
{
this
.
removeStudipQuote
(
editor
);
editor
.
execute
(
'
removeStudipQuote
'
);
});
});
return
view
;
return
view
;
});
});
}
}
}
insertStudipQuote
(
editor
)
{
class
InsertStudipQuoteCommand
extends
Command
{
// If quoting is changed update these functions:
execute
()
{
// - StudipFormat::markupQuote
// lib/classes/StudipFormat.php
// - quotes_encode lib/visual.inc.php
// - STUDIP.Forum.citeEntry > quote
// public/plugins_packages/core/Forum/javascript/forum.js
// - StudipBlockQuote > insertStudipQuote
// resources/assets/javascripts/cke/studip-quote/StudipBlockQuote.js
var
writtenBy
=
$gettext
(
'
%s hat geschrieben:
'
);
var
writtenBy
=
$gettext
(
'
%s hat geschrieben:
'
);
const
content
=
const
content
=
'
<blockquote><div class="author">
'
+
'
<blockquote><div class="author">
'
+
writtenBy
.
replace
(
'
%s
'
,
$gettext
(
'
"Name"
'
))
+
writtenBy
.
replace
(
'
%s
'
,
$gettext
(
'
"Name"
'
))
+
'
</div><p> </p></blockquote><p> </p>
'
;
'
</div><p> </p></blockquote><p> </p>
'
;
const
viewFragment
=
editor
.
data
.
processor
.
toView
(
content
);
const
viewFragment
=
this
.
editor
.
data
.
processor
.
toView
(
content
);
const
modelFragment
=
editor
.
data
.
toModel
(
viewFragment
);
const
modelFragment
=
this
.
editor
.
data
.
toModel
(
viewFragment
);
editor
.
model
.
insertContent
(
modelFragment
);
this
.
editor
.
model
.
insertContent
(
modelFragment
);
}
}
}
splitStudipQuote
(
editor
)
{
class
SplitStudipQuoteCommand
extends
Command
{
const
position
=
editor
.
model
.
document
.
selection
.
getFirstPosition
();
execute
()
{
const
position
=
this
.
editor
.
model
.
document
.
selection
.
getFirstPosition
();
const
quote
=
position
.
findAncestor
(
'
blockQuote
'
);
const
quote
=
position
.
findAncestor
(
'
blockQuote
'
);
if
(
quote
!==
null
)
{
if
(
quote
!==
null
)
{
editor
.
model
.
change
((
writer
)
=>
{
this
.
editor
.
model
.
change
((
writer
)
=>
{
const
limitElement
=
quote
.
parent
;
const
limitElement
=
quote
.
parent
;
const
split
=
writer
.
split
(
position
,
limitElement
);
const
split
=
writer
.
split
(
position
,
limitElement
);
writer
.
insertElement
(
'
paragraph
'
,
split
.
position
);
writer
.
insertElement
(
'
paragraph
'
,
split
.
position
);
});
});
}
}
}
}
}
removeStudipQuote
(
editor
)
{
class
RemoveStudipQuoteCommand
extends
Command
{
const
position
=
editor
.
model
.
document
.
selection
.
getFirstPosition
();
execute
()
{
const
position
=
this
.
editor
.
model
.
document
.
selection
.
getFirstPosition
();
const
quote
=
position
.
findAncestor
(
'
blockQuote
'
);
const
quote
=
position
.
findAncestor
(
'
blockQuote
'
);
if
(
quote
!==
null
)
{
if
(
quote
!==
null
)
{
editor
.
model
.
change
((
writer
)
=>
{
this
.
editor
.
model
.
change
((
writer
)
=>
{
// Remove the top "written by" bar
// Remove the top "written by" bar
for
(
var
child
of
quote
.
getChildren
())
{
for
(
var
child
of
quote
.
getChildren
())
{
if
(
if
(
...
...
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