Fix to drop pretty redundant Expert mode to: Basic, Simple, Advanced

This commit is contained in:
iliajie
2023-06-18 16:14:41 +03:00
parent c80d854054
commit 9c348f7909
4 changed files with 12 additions and 31 deletions

View File

@@ -51,7 +51,7 @@ if ($opts->{'extra'}->{'js'}) {
# Automatically load dependencies
# based on editor mode
if ($opts->{'type'} =~ /^(advanced|expert)$/) {
if ($opts->{'type'} eq "advanced") {
my $highlight_bundle = ['highlight/highlight'];
my @highlight_bundle = @{$highlight_bundle};
if ($opts->{'_'}->{'client'}->{'palette'} eq 'dark') {
@@ -174,7 +174,8 @@ if ($opts->{'type'} eq 'basic') {
return
<<EOF;
[
['bold', 'italic', 'underline', 'strike'],
['bold', 'italic'],
[{'color': []}],
['blockquote']
]
EOF
@@ -185,36 +186,18 @@ if ($opts->{'type'} eq 'simple') {
[
[{'font': [false, 'monospace']},
{'size': ['0.75em', false, "1.15em", '1.3em']}],
['bold', 'italic', 'underline', 'strike'],
['bold', 'italic', 'underline'],
[{'color': []}, {'background': []}],
[{'align': []}],
['blockquote'],
['link'],
['image'],
['clean']
]
EOF
}
if ($opts->{'type'} eq 'advanced') {
return
<<EOF;
[
[{'font': [false, 'monospace']},
{'size': ['0.75em', false, "1.15em", '1.3em']}],
['bold', 'italic', 'underline', 'strike'],
[{'color': []}, {'background': []}],
[{'align': []}],
[{'list': 'ordered'}, {'list': 'bullet'}],
[{'indent': '-1'}, {'indent': '+1'}],
['blockquote'],
(typeof hljs === 'object' ? ['code-block'] : []),
['link'],
['image'],
[{'direction': 'rtl'}],
['clean']
]
EOF
}
if ($opts->{'type'} eq 'expert') {
return
<<EOF;
[
[{'font': [false, 'monospace']},
@@ -229,12 +212,12 @@ if ($opts->{'type'} eq 'expert') {
['blockquote'],
(typeof hljs === 'object' ? ['code-block'] : []),
['link'],
['image', 'video'],
['image'],
[{'direction': 'rtl'}],
['clean']
]
EOF
}
}
}
sub html_editor_init_script
@@ -247,9 +230,7 @@ my $target_type = $target_text->{'type'} || '=';
my $target_name = $target_text->{'name'};
# HTML editor toolbar mode
my $iframe_styles_mode =
$opts->{'type'} =~ /(^advanced|expert$)/ ? 'advanced' :
$opts->{'type'} eq 'basic' ? 'basic' : 'simple';
my $iframe_styles_mode = $opts->{'type'};
my $iframe_styles =
&quote_escape(
&read_file_contents("$root_directory/unauthenticated/css/_iframe/$iframe_styles_mode.min.css"), '"');

View File

@@ -26,7 +26,7 @@ no_crlf=0
sync_perms=0700
show_mail=0
html_edit=2
html_edit_mode=advanced
html_edit_mode=simple
check_mod=1
spam_buttons=mail
show_delall=0

View File

@@ -12,7 +12,7 @@ delete_warn=Ask for confirmation before deleting?,10,y-Yes,n-No,For mbox files l
view_html=Show message body as,4,0-Always plain text,1-Text if possible&#44; HTML otherwise,2-HTML if possible&#44; text otherwise,3-Convert HTML to plain text
view_images=Show inline images by default?,1,0-Yes&#44; client fetched,3-Yes&#44; server fetched,1-No external images,2-No
html_edit=Use HTML editor for composing?,4,2-Always,1-When replying to HTML email,0-Never
html_edit_mode=HTML editor toolbar mode?,4,basic-Basic,simple-Simple,advanced-Advanced,expert-Expert
html_edit_mode=HTML editor toolbar mode?,4,basic-Basic,simple-Simple,advanced-Advanced
html_quote=HTML quoting mode,1,1-Message below &lt;hr&gt;,0-Message inside &lt;blockquote&gt;
log_read=Record the reading of mail in the Webmin Actions Log?,1,1-Yes,0-No
bcc_to=Bcc: sent messages to,0

View File

@@ -460,7 +460,7 @@ my $html_editor = &html_editor(
data => [ { iframe => '#quote-mail-iframe',
elements => ['#webmin-iframe-quote'] } ] }
},
type => $config{'html_edit_mode'} || 'advanced',
type => $config{'html_edit_mode'} || 'simple',
after =>
{ editor => $iframe_quote }
});