Merge pull request #452 from writefreely/fix-ace-touchscreens

Disable Ace editor on touchscreen devices
pull/456/head
Matt Baer 4 years ago committed by GitHub
commit c0fdd8af49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 33
      templates/user/collection.tmpl

@ -12,6 +12,12 @@ textarea.section.norm {
max-height: 20em; max-height: 20em;
resize: vertical; resize: vertical;
} }
@media (pointer: coarse) {
.codable {
font-size: 0.75em !important;
height: 17em !important;
}
}
</style> </style>
<div class="content-container snug"> <div class="content-container snug">
@ -258,18 +264,21 @@ var $customDomain = document.getElementById('domain-alias');
var $customHandleEnv = document.getElementById('custom-handle-env'); var $customHandleEnv = document.getElementById('custom-handle-env');
var $normalHandleEnv = document.getElementById('normal-handle-env'); var $normalHandleEnv = document.getElementById('normal-handle-env');
var opt = { if (matchMedia('(pointer:fine)').matches) {
showLineNumbers: false, // Only initialize Ace editor on devices with a mouse
showPrintMargin: 0, var opt = {
minLines: 10, showLineNumbers: false,
maxLines: 40, showPrintMargin: 0,
}; minLines: 10,
var theme = "ace/theme/chrome"; maxLines: 40,
var cssEditor = ace.edit("css-editor"); };
cssEditor.setTheme(theme); var theme = "ace/theme/chrome";
cssEditor.session.setMode("ace/mode/css"); var cssEditor = ace.edit("css-editor");
cssEditor.setOptions(opt); cssEditor.setTheme(theme);
cssEditor.resize(true); cssEditor.session.setMode("ace/mode/css");
cssEditor.setOptions(opt);
cssEditor.resize(true);
}
</script> </script>
{{template "footer" .}} {{template "footer" .}}

Loading…
Cancel
Save