Simditor.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace addons\simditor;
  3. use app\common\library\Menu;
  4. use think\Addons;
  5. /**
  6. * 插件
  7. */
  8. class Simditor extends Addons
  9. {
  10. /**
  11. * 插件安装方法
  12. * @return bool
  13. */
  14. public function install()
  15. {
  16. return true;
  17. }
  18. /**
  19. * 插件卸载方法
  20. * @return bool
  21. */
  22. public function uninstall()
  23. {
  24. return true;
  25. }
  26. public function upgrade()
  27. {
  28. return true;
  29. }
  30. /**
  31. * @param $params
  32. */
  33. public function configInit(&$params)
  34. {
  35. $config = $this->getConfig();
  36. $params['simditor'] = [
  37. 'classname' => $config['classname'] ?? '.editor',
  38. 'height' => $config['height'] ?? 250,
  39. 'minHeight' => $config['minHeight'] ?? 250,
  40. 'placeholder' => $config['placeholder'] ?? '',
  41. 'toolbarFloat' => $config['toolbarFloat'] ?? 0,
  42. 'toolbar' => (array)json_decode($config['toolbar'] ?? '', true),
  43. 'mobileToolbar' => (array)json_decode($config['mobileToolbar'] ?? '', true),
  44. 'isdompurify' => !!($config['isdompurify'] ?? '0'),
  45. 'allowiframeprefixs' => $config['allowiframeprefixs'] ?? []
  46. ];
  47. }
  48. }