You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

IEditor.php 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2019 Julius Härtl <jus@bitgrid.net>
  5. *
  6. * @author Julius Härtl <jus@bitgrid.net>
  7. *
  8. * @license GNU AGPL version 3 or any later version
  9. *
  10. * This program is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License as
  12. * published by the Free Software Foundation, either version 3 of the
  13. * License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU Affero General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public License
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. *
  23. */
  24. namespace OCP\DirectEditing;
  25. use OCP\AppFramework\Http\Response;
  26. /**
  27. * @since 18.0.0
  28. */
  29. interface IEditor {
  30. /**
  31. * Return a unique identifier for the editor
  32. *
  33. * e.g. richdocuments
  34. *
  35. * @since 18.0.0
  36. * @return string
  37. */
  38. public function getId(): string;
  39. /**
  40. * Return a readable name for the editor
  41. *
  42. * e.g. Collabora Online
  43. *
  44. * @since 18.0.0
  45. * @return string
  46. */
  47. public function getName(): string;
  48. /**
  49. * A list of mimetypes that should open the editor by default
  50. *
  51. * @since 18.0.0
  52. * @return array
  53. */
  54. public function getMimetypes(): array;
  55. /**
  56. * A list of mimetypes that can be opened in the editor optionally
  57. *
  58. * @since 18.0.0
  59. * @return array
  60. */
  61. public function getMimetypesOptional(): array;
  62. /**
  63. * Return a list of file creation options to be presented to the user
  64. *
  65. * @since 18.0.0
  66. * @return array of ICreateFromTemplate|ICreateEmpty
  67. */
  68. public function getCreators(): array;
  69. /**
  70. * Return if the view is able to securely view a file without downloading it to the browser
  71. *
  72. * @since 18.0.0
  73. * @return bool
  74. */
  75. public function isSecure(): bool;
  76. /**
  77. * Return a template response for displaying the editor
  78. *
  79. * open can only be called once when the client requests the editor with a one-time-use token
  80. * For handling editing and later requests, editors need to impelement their own token handling and take care of invalidation
  81. *
  82. * This behavior is similar to the current direct editing implementation in collabora where we generate a one-time token and switch over to the regular wopi token for the actual editing/saving process
  83. *
  84. * @since 18.0.0
  85. * @return Response
  86. */
  87. public function open(IToken $token): Response;
  88. }