Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File manager: path to document incomplete when source is in a subdirectory #177

Open
ockam opened this issue Apr 22, 2015 · 2 comments
Open

Comments

@ockam
Copy link

ockam commented Apr 22, 2015

When setting the uriPublic properties of the File Manager plugin to a directory that contains other directories, I can navigate those subdirectories to select any file I want, but when I do, the path to the file only contains uriPublic/filename. The subdirectories are missing from the path.

Am I doing something wrong or this is a bug?

@Petah
Copy link
Contributor

Petah commented Apr 23, 2015

Umm, sounds like a bug. Could you show me you complete initialisation config so I can have a deeper look?

@zzal
Copy link

zzal commented Apr 23, 2015

Hi, I’m ockam’s colleague.
Here you will find the initialisation config. But just before I need to mention that we’re using Raptor inside an AngularJS CMS app, with a “live-editing” feature that was using another WYSIWYG HTML editor before implementing it with Raptor. Maybe it’s just our implementation that is misguided…
Here it is:

var raptorInstance = null;

$($rootElement.get(0)).raptor({
  enablePlugins: true,
  autoEnable: false,
  enableUi: true,
  draggable: false,
  persistence: false,
  persistenceName: "uiEditor-inline",
  unloadWarning: false,
  bind: {
    ready: function()
    {
      raptorInstance = this;

      // Here we have some code that custom-manage the position of the toolbar...
    },

    disabled: function()
    {
      raptorInstance.target.removeClass('tadam-editing').addClass('tadam-editable');
    },

    enabled: function()
    {
      raptorInstance.target.removeClass('tadam-editable').addClass('tadam-editing');
    },

    saved: function()
    {
      raptorInstance.stopEditing();
    },

    change: function()
    {
      $(window).trigger('scroll');
    },

    resize: function()
    {
      $(window).trigger('scroll');
    },

    dirty: function()
    {
      $rootScope.broadcast('event:pageUpdated');
    },
  },
  classMenu: {
    classes: {
      'Blue background': "cms-blue-bg",
      'Indent and center': "cms-indent-center",
      'Round corners': "cms-round-corners"
    }
  },
  plugins: {
    save: {
      plugin: 'saveFake'
    },
    saveFake: {
      url: angular.noop,
      id: angular.noop,
      postName: '',
    },
    saveJson: {
      url: angular.noop,
      id: angular.noop,
      postName: '',
    },
    saveRest: {
      url: angular.noop,
      data: angular.noop,
    },
    unsavedEditWarning: false,
    revisions: false,
    fileManager: {
      uriAction: "/path/to/file-manager.php",
      uriIcon:   "/path/to/raptor/icon/",
      uriPublic: "/path/to/assets/upload/"
    },
    imageSwap: {
      chooser: 'fileManager'
    },
    dock: {
      docked: true,
      dockToElement: false,
    },
  },

  layouts: {
      toolbar: {
          uiOrder: [['save','discard'], etc…]
      },
      hoverPanel: {
          uiOrder: [
              []
          ]
      },
      elementHoverPanel: {
          elements: 'img',
          uiOrder: [
              ['imageResize', 'imageSwap']
          ]
      }
  }
});

And for saveFake plugin, it’s a plugin that we made to help us manage the save action that the Angular app takes care of (yes, it may be twisted, but beside the path bug, it’s working!):

var SaveFakePlugin = Object.create(window.Raptor.plugins.saveJson);
SaveFakePlugin.name = 'saveFake';
SaveFakePlugin.save = function()
{
  var html;
  this.raptor.unify(function(raptor)
  {
    html = raptor.getHtml();
    raptor.setOriginalHtml(html);
    raptor.disableEditing();
  }.bind(this));
};

window.Raptor.plugins.saveFake = SaveFakePlugin;
window.Raptor.setLocale('fr');

window.Raptor.registerUi(new window.Raptor.Button({
  name: 'discard',
  title: 'Ignorer les modifications',

  action: function()
  {
    $rootScope.broadcast('event:discardChanges');
  }
}));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants