【问题标题】:PHPMYADMIN resize editor height sizePHPMYADMIN 调整编辑器高度大小
【发布时间】:2014-07-22 05:24:17
【问题描述】:

在下面的 phpmyadmin 截图中,您可以看到 phpmyadmin 的编辑器大小有限。
高度非常小,我们在使用此编辑器进行编码时遇到问题。
如何调整此编辑器的大小?

标准编辑器:

内联编辑器:

【问题讨论】:

  • 您使用的是哪个 phpMyAdmin 版本?在当前版本 (4.2.6) 中,您在此窗口的右下角有一个调整大小控件。
  • @MarcDelisle 我的 phpmyadmin 是 4.2.6,我在右下角看不到任何控件
  • 请描述您的浏览器。
  • @MarcDelisle 、Firefox 和其他问题是输入标签中没有日期时间选择器
  • 我无法在 Firefox 中重现您的问题(您使用的是哪个 Firefox 版本?);您是否在禁用所有 Firefox 扩展后尝试过?另外,您是否尝试过使用其他浏览器?

标签: php html mysql css phpmyadmin


【解决方案1】:

我所做的是我为 Chrome 下载了 TamperMonkey(对于 Firefox 为GreaseMonkey)并创建了我自己的脚本来覆盖样式。

您也可以这样做,只需打开界面,添加一个新脚本并将其粘贴到:

// ==UserScript==
// @name         phpMyAdmin SQL editor height fix
// @namespace    http://josephwebber.ca/
// @version      1.1
// @description  Changes the SQL editors' height
// @author       Joseph Webber
// @match        phpMyAdmin
// @include      */phpMyAdmin/*
// @grant        GM_addStyle
// ==/UserScript==
/* jshint -W097 */
'use strict';

// 1.0    
//GM_addStyle(".CodeMirror { min-height: 49px !important } .CodeMirror, #inline_editor_outer .CodeMirror, .CodeMirror-wrap .CodeMirror-scroll { height: auto !important; }");

// 1.1
GM_addStyle(".CodeMirror { min-height: 49px !important } .CodeMirror, #inline_editor_outer .CodeMirror, .CodeMirror-wrap .CodeMirror-scroll { height: auto !important; } .sql { max-height: initial !important; }");

这样即使phpMyAdmin的文件更新了,你的修改也不会被覆盖。

【讨论】:

    【解决方案2】:

    有两种方法可以做到这一点,一种适用于该会话,但是一旦刷新页面或重新打开浏览器,您将不得不重做这些步骤。

    临时解决方案:

    在谷歌浏览器/您最喜欢的网络浏览器中,右键单击内联编辑器并选择检查元素。

    找到<div class="CodeMirror cm-s-default CodeMirror-wrap"> 并在样式更改下:

    #inline_editor_outer .CodeMirror {
      height: 6em;
    }
    

    到更大的东西,比如60em;

    永久的解决方案是编辑phpmyadmin.css 并更改该行。我正在运行的版本是 ~line 3885。

    这会使框变大,但它在该区域放置滚动条之前允许的文本行数与您得到的相同 5 到 10 行。所以我们需要再做一次改变。

    <div class="CodeMirror-scroll" tabindex="-1" style="height: 75px;">
    

    是下一个违规行。在 Chrome Inspector 中将 height: 75px; 更改为 height: 750px;

    由于这是通过 style 属性而不是 CSS 完成的,我认为除非您编辑 sql.php 文件并找到它在哪里制作该属性并重写它,否则您无法将其永久修复。

    不知道为什么他们不只是在右下角添加一个东西,这样你就可以增加盒子的大小,这也让我发疯。

    编辑:如果您曾经编写过 GreaseMonkey 脚本或 Google Chrome 扩展程序或为我解决此问题的东西 - 请告诉我!

    【讨论】:

    • 感谢您的回复。我可以在 phpmyadmin Features 中找到此设置,但此功能没有任何内联编辑器大小设置。
    • 我为这个问题做了一个 TamperMonkey/GreaseMonkey 脚本,看看我的答案。
    • @JosephWebber 感谢 Joseph,为您的回答 +1,它按预期工作。
    • @RyanKempt cPanel 更新了他们的 phpMyAdmin,为窗口添加了最大高度。您所要做的就是将.sql { max-height: initial !important } 添加到我的答案中以使其再次起作用(请参阅更新的答案)。
    【解决方案3】:

    为了增加内嵌编辑框的高度,请在下面的步骤中进行。

    对于 phpmyadmin 版本:4.5.1。主题:pmahomme

    我的 phpmyadmin 主题文件夹路径:C:\xampp\phpMyAdmin\themes\pmahomme\css

    编辑:codemirror.css.php

    发件人:#inline_editor_outer .CodeMirror { height: <?php echo ceil($GLOBALS['cfg']['TextareaRows'] * 0.4); ?>em; }

    收件人:#inline_editor_outer .CodeMirror { height: <?php echo ceil($GLOBALS['cfg']['TextareaRows'] * **2**); ?>em **!important**; }

    然后执行 Ctrl+f5 - 刷新 phpmyadmin 选项卡。

    【讨论】:

      【解决方案4】:

      在您的 config.inc.php 文件中,您可以在 phpmyadmin 文件夹中找到该文件,如果您手动安装它,或者如果您在 Ubuntu 下将它作为 /etc/phpmyadmin/config.inc.php 下的一个包安装它

      您在底部附近添加以下行

      $cfg['TextareaRows'] = 8; // number of rows for the sql editor textarea
      

      文件末尾以上

      /* Support additional configurations */
      foreach (glob('/etc/phpmyadmin/conf.d/*.php') as $filename)
      {
          include($filename);
      }
      

      然后保存并重新加载您的 phpmyadmin 页面。更改立即生效。

      在这个文件中你也可以设置很多其他的配置。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-04-02
        • 2015-02-16
        • 2013-10-09
        • 2020-05-14
        • 1970-01-01
        • 2014-05-19
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多